startup time, loaded modules in external shell

15 views
Skip to first unread message

josef...@gmail.com

unread,
Oct 22, 2010, 11:04:09 AM10/22/10
to spyd...@googlegroups.com
When I run a simple script in an external shell then more than 600
modules, len(sys.modules), are loaded. As a consequence for quick
testing, the startup of the external shell is very slow (at least on
my old computer).

Are these all necessary (enthought tools, matplotlib) or is there an
option to avoid loading them automatically ?

I discovered "Open Command Prompt", so I'm also able to quickly test a
module in a plain vanilla shell inside spyder.

Josef

Pierre Raybaut

unread,
Oct 31, 2010, 10:07:29 AM10/31/10
to spyder
That is an excellent point, Josef.

Actually, the reason why the external shell startup may be so long
(and module list may be so huge) is that it loads everything needed
for the code instropection (code completion, ...) and variable
explorer features to be available.

For example, for the variable explorer to be able to show images or
plot curves, one must first load Matplotlib (and its dependencies:
PyQt, NumPy, ...). So, yes, doing this every time you open an
interpreter or run a script may be quite long on slow machines.

That is why I've added an option (in Mercurial version of v2.0) to
disable the 'monitor' which is the mechanism used by the external
shell to communicate for code instropection and variable explorer
features. When disabling the monitor, opening a new interpreter or run
a script should be as fast as outside Spyder... but, like outside
Spyder, you won't have variable explorer support.

Furthermore, following your post, I did some code cleaning to avoid
any unnecessary import in the external shell. So basically it should
be faster anyway (with or without the monitor).

Cheers,
Pierre

Pierre Raybaut

unread,
Oct 31, 2010, 10:13:46 AM10/31/10
to spyder
BTW, if you want to accelerate the external shell startup, you would
have to disable the Matplotlib patch too, of course (as far as I know,
one cannot monkey-patch a module without importing it).

And after some testing, it appears that disabling the Matplotlib patch
has much more effect on Python interpreter startup than disabling the
monitor.

The option to disable the monitor is in "Preferences > Console >
Introspection".
Reply all
Reply to author
Forward
0 new messages