[IPython-dev] slow startup due to script magic

Jason Grout jason-sage at creativetrax.com
Sat Sep 22 21:19:53 EDT 2012

On 9/22/12 1:33 PM, Fernando Perez wrote:
> On Sat, Sep 22, 2012 at 3:40 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>> Hmm, well spotted. If it's that slow, I think we should avoid doing it
>> during IPython start up at all. I like it to start up quickly.
> Absolutely, thanks for catching this, Jason!  Indeed, startup time is
> a really important consideration, and we should be very careful with
> it.
> Does anyone have a tool to instrument the startup process in an easy
> manner?  Jason, if you guys have any such tools for Sage that you
> could share, we could track these things and prevent similar
> regressions in the future.

We do have a sage -startuptime script that (I think) uses an import hook 
to track the time to import the many modules that Sage imports.  It 
sounds like that may not be as useful to you guys, since you don't 
import nearly as many things as we do.  And that's mainly for us to 
diagnose startup time regressions by hand.

I suppose it would be pretty straightforward to add a nose test that 
would check the time to start a full kernel, right?

>> Maybe we should keep it simple: rather than checking for the existence
>> of each interpreter, just set a standard list. It would mean that
>> users can tab complete e.g. %%pypy, even if they don't have pypy
>> installed, but I don't think it will be too surprising if they try it
>> and it fails.
> We could also cache the search path and do it only on first usage,
> rather than at IPython startup.  Else we can discuss moving this to an
> optional extension...

It's also less confusing to have a standard list that is always 
available.  Otherwise I have to try to guess why in the world I have 
%%ruby, but you don't.

I'd say that %%ruby should invoke ruby with "/bin/env ruby" and leave it 
at that.  Why do we need to cache the path?



More information about the IPython-dev mailing list