Python IDLE becomes slow on very large program input -


why python idle become slow when handling large inputs, when python command line not?

for example, if run "aman"*10000000 in python idle, becomes unresponsive, on python cmd line, quick.

i had research bit. when invoked idle on machine, saw python process uses idlelib

~$ ps -eaf | grep -in idle 234:1000     13122     1  5 16:44 ?        00:00:01 /usr/bin/python2.7 /usr/bin/idle-python2.7 235:1000     13124 13122  3 16:44 ?        00:00:01 /usr/bin/python2.7 -c __import__('idlelib.run').run.main(true) 60839 239:1000     13146 12061  0 16:44 pts/0    00:00:00 grep --color=auto -in idle ~$  

the last parameter (60839) made me think. looked around idlelib , got implementation here https://github.com/pypy/pypy/blob/master/lib-python/2.7/idlelib/run.py#l49 comment there says

start python execution server in subprocess      in python subprocess, rpcserver instantiated handlerclass     myhandler, inherits register/unregister methods rpchandler via     mix-in class socketio. 

now, things clear me. idle sends commands python interpreter on tcp connection. still, not convinced. read complete help->about idle->readme. says

idle executes python code in separate process, restarted each run (f5) initiated editor window. environment can restarted shell window without restarting idle.

conclusion

when have such dependency (idle depending on response on socket), delay experienced fine.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -