[英]speed python script on command line vs launched in IDLE shell
I noticed several times that a simple python script (with some straightforward algebraic computation in a loop) runs considerably faster (up to a factor 6) when launched on a shell command line as compared to a run via IDLE's shell. 我多次注意到,与通过IDLE的shell运行相比,在shell命令行上启动时,简单的python脚本(在循环中进行一些简单的代数计算)运行速度快得多(达到6倍)。 There is nothing fancy going on in the script.
脚本中没有任何幻想。 I only print a loop variable to visually follow progress in the loop.
我只打印一个循环变量以直观地跟踪循环的进度。
Surely just this print statement cannot be the reason for the speed loss in IDLE, or can it ? 当然,仅此打印语句不能成为IDLE速度下降的原因,还是可以吗?
Can someone explain me why this is ? 有人可以解释我为什么吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.