[yt-dev] Importing yt versus importing yt.mods

Matthew Turk matthewturk at gmail.com
Tue Mar 18 07:20:01 PDT 2014


Hi all,

Some of this was hashed out before on the YTEP-0019 discussion, but I
am going through and re-implementing some of that now and I wanted to
bring it back to the group.

What we had come up with was:

 * import yt => gets most of the items used in yt in the main namespace
 * import yt.mods => treats yt more like an application, gets
everything but *also* does "startup tasks"

Now, the big benefit to making it like this is that you can do:

import yt

and get everything.  The *downside* is that we will no longer be able to do:

import yt.something.something_else

and *avoid* importing all of yt.  I've experimented with the import
times and came up with this.  All times were computed by running 10
cycles, dividing total time by 10.

 * 2.6 (current @ bookmark) => 0.45s per import
 * 3.0, "development" => 0.47s per import
 * My YTEP-0019 bookmark => 0.97s per import
 * Import numpy and matplotlib => 0.22s per import
 * Importing numpy, matplotlib, *and* sympy => 0.78s per import

So I think we're doing okay on import times, although I must confess
when I initial ran it and saw how slow importing the unitrefactor
branch was I was a bit worried.  But most of that is sucked up into
numpy, matplotlib and sympy.  I guess it's not so bad.

Here's my PR:

https://bitbucket.org/yt_analysis/yt/pull-request/729/ytep-0019/diff

(bookmark: ytep0019, which I will delete later.)

-Matt



More information about the yt-dev mailing list