[summerofcode] idea of speedup interpreter startup
Linan Wang
tali.wang at gmail.com
Tue Jun 7 03:38:51 CEST 2005
Thanks.
I'm looking into the source code, try to figure out things like frame,
code, node :)
Just like what you said, a proxy with a pool seems to be a plan.
>From python code to frame, each convert creat a gap. Is it possible to
create a pool for all gaps?
I think the lazy importation may cause one problem that not all the
code will be compiled after a script executed. For a module, if not
all the codes compiled, how to generate .pyc file?
On 6/6/05, Brett C. <bac at ocf.berkeley.edu> wrote:
> Linan Wang wrote:
> > hi, everybody,
> >
> > Let's go to the topic directly :)
> > I propose to use "lazy import" strategy to handle modula import.
> > The term lazy here means import the compiled function's code only
> > before first using it. Sometimes we only use few functions/classes in
> > a module, but it seems we import all the compiled code when we do
> > importing.
>
> Right. Even if you do ``from module import *`` the module still ends up in
> sys.modules; you just specify what ends up in your namespace.
>
> > It's quite a waste of time and resource.
>
> Don't know if that is fair to say. Remember that the initial importation
> executes the module. Also remember that 'class' and 'def' are statements;
> Guido has stated multiple times they should be viewed as such. So executing
> the entire module, including 'class' and 'def' is not a waste since the
> semantics are straight-forward to explain.
>
> > By introducing a function/class table at some place of compiled code,
> > we can import only the definition of the module. When before firing a
> > function in a module, interpreter does the real import action.
> >
>
> So like a proxy in the module type that, if a lookup fails, goes out to the
> bytecode to load the code. A table in the bytecode could specify offsets into
> the bytecode, execute the code for the module attribute, and store the result
> into the proxy.
>
> > This idea maybe considered before and abandoned because of the cost
> > of IO operation, rr, the implementation of lazy strategy for classes
> > import is a quite complex.
> >
> > Does this idea make sense? Any mentors want to give me some ideas?
> > Thanks alot!
> >
>
> It makes sense, but I just wonder if it is worth the added complication. It
> might be a real boon, though. Be interesting to find out which way it goes!
>
> -Brett
>
--
Wang
-----------------------------------------------
Email:tali.wang at gmail.com
Or: arp04lw at shef.ac.uk
Mobile:+44-7760-338-932
-----------------------------------------------
More information about the summerofcode
mailing list