|
From: | Bill Denney |
Subject: | Re: Interpreter performance |
Date: | Sun, 01 Oct 2006 10:07:50 -0400 |
User-agent: | Thunderbird 1.5.0.7 (Windows/20060909) |
John W. Eaton wrote:
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 likeLooping, 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.
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); endifIn some tests on some of the easy-to-modify string functions, this can give a ~2-3x speed up.
Bill
[Prev in Thread] | Current Thread | [Next in Thread] |