[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpreter performance

From: John W. Eaton
Subject: Re: Interpreter performance
Date: Sun, 1 Oct 2006 10:38:33 -0400

On  1-Oct-2006, Bill Denney wrote:

| John W. Eaton wrote:
| > Looping, conditionals, and funtion calling is pretty much what the
| > interpreter does.  When you do core operations on large matrices, then
| > you are likely out of the realm of the interpreter.  You have one
| > funtion call that does a lot of work.  The function call is still
| > slow, but that is not as noticeable because your (large) operation is
| > taking a lot more time, and the interpreter is doing less.
| To try to make this better, would you accept patches that try to avoid 
| the looping, conditionals, etc.?  I'm thinking about trying to go 
| through the source tree and use cellfun instead of constructs like
| if iscell (x)
|   for i = 1:numel (x)
|     retval(i) = function(x{i});
|   endfor
| endif
| replace them with
| if iscell (x)
|   retval = cellfun ("function", x);
| endif
| In some tests on some of the easy-to-modify string functions, this can 
| give a ~2-3x speed up.

How many places does is this kind of loop used?

If the return value is supposed to be a cell array then I think the
call should be

  cellfun (@function, x, "UniformOutput", false);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]