[PEAK] Regular functions vs generic functions
rdmurray at bitdance.com
rdmurray at bitdance.com
Fri Feb 15 10:36:37 EST 2008
On Fri, 15 Feb 2008 at 09:41, Phillip J. Eby wrote:
> Well, there is overhead for setting up and "compiling" the function. Some of
> that overhead occurs at declaration time, and some is deferred until the next
> time the function is called. Also, some parts of the dispatch facility
> (mainly comparison operators), have function-call overhead at the moment,
> although I plan to inline that eventually.
Interestingly, in this application I'm working on (well, I've stopped
working on it again for the moment as there are other things on my plate
that have bumped it), there is a noticeable startup delay when the first
generic function with a complex dispatch tree is called. When I say
noticeable, I mean on the order of five seconds. There are several sets of
rules, all of which are getting invoked during that five second startup.
The two biggest have 23 members and 26 members. In the one with 26, the
rules average around six comparison and/or truth test operations each.
In this particular application the startup time does not matter (much),
but I can imagine that there might be applications in which it would.
Is there any way this stuff could be pre-compiled and stored in the
.pyc files? Would it be enough just to arrange to make the first call
to the generics at the module level at "compile time"?
--David
More information about the PEAK
mailing list