Improving interpreter startup speed

James Mills prologic at shortcircuit.net.au
Sun Oct 26 21:57:27 EDT 2008


On Mon, Oct 27, 2008 at 3:45 AM, BJörn Lindqvist <bjourne at gmail.com> wrote:
> Pedro was talking about cold startup time:
>
> $ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
> $ time python -c "pass"
>
> real    0m0.627s
> user    0m0.016s
> sys     0m0.008s

$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
$ time python -S -c "pass"

real	0m0.244s
user	0m0.004s
sys	0m0.008s

With -S (don't imply 'import site' on initialization)

I suspect that's to do with importing modules,
the site specific modules, etc. Disk access will
tend to chew into this "startup time". Use -S
if you're that worried about startup times (heaven
knows what affect it'll have on your app though).

--JamesMils

-- 
--
-- "Problems are solved by method"


More information about the Python-list mailing list