[Tutor] Finding prime numbers script runs much faster when run viabash shell than idle

Alan Gauld alan.gauld at btinternet.com
Sat Apr 2 10:05:14 CEST 2011


"Jaime Gago" <contact at jaimegago.com> wrote 

>  When I run it via IDLE it's taking way more time than 
> if I run it via a (bash) shell (on Os X 10.6) while 
> doing $>python -d mypp.py
> 
> I'm really curious from a performance perspective 
> as to what could cause such a noticeable difference.

IDLE is a development environment. As such it 
adds lots of extra hooks and debugging things 
to the execution environment. (For example it 
traps things like Ctrl C) In addition, being a GUI 
written in Tkinter, it has a slower output mechanism
so print statements will be slower.

IDLE is not intended to be used to run code except 
during development, it has ot been built for speed 
but for debugging.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list