octave-maintainers
[Top][All Lists]
Advanced

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

Re: Eliminating Singleton Objects


From: John W. Eaton
Subject: Re: Eliminating Singleton Objects
Date: Fri, 28 Apr 2017 21:17:59 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 04/28/2017 07:49 PM, Rik wrote:

Is there a performance issue here?  If you start passing too many
arguments to a function, more than can conveniently fit into the number
of scratch registers that your CPU has, then you have to pass arguments
on the stack which will slow things down.  But I can't quite tell if you
are suggesting another parameter, or whether you want to include the
pointer to the interpreter as say the first entry in the
octave_value_list passed as inputs to the function.  Presumably the
octave_value_list is already passed as a pointer/reference since it
could be large.  In that case it wouldn't have an impact.

At first, I thought it would be easier to just add a pointer to the interpreter object to the octave_value_list that is passed to functions. But it turned out to be difficult to chase down all the places where it is needed. There are many locations where it could be needed and I couldn't figure out an easy way to get help from the compiler.

So I started working on passing the pointer to the interpreter as an additional parameter to DEFUN functions. It seems much cleaner this way. It also means that these functions will now accept three arguments instead of two. One is a pointer to the interpreter, one is a const reference to the octave_value_list containing the arguments, and one is an int for nargout. I doubt that passing one additional pointer to these functions will make a big difference overall, but we can certainly measure it to be sure.

jwe




reply via email to

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