Oct-24-2018, 02:48 PM
(This post was last modified: Oct-24-2018, 02:48 PM by mhvozdesky.)
Hello!
Why does the speed of performance of functions differ depending on where they are launched?
If I run in the console - program runs faster than in IDE (I use Wing IDE)
Example.
Execution time in console:
3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40)
_________________________________
forLoop : 1.8672226498562265 =>
_________________________________
listComp : 1.0452214996682148 =>
_________________________________
mapCall : 0.5306503870825039 =>
_________________________________
genExpr : 1.427833488166335 =>
_________________________________
genFunc : 1.4664546781685468 =>
Execution time in IDE:
3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40)
_________________________________
forLoop : 4.45649404998894 =>
_________________________________
listComp : 1.9458866622428665 =>
_________________________________
mapCall : 0.5576458305684584 =>
_________________________________
genExpr : 12.455734571997347 =>
_________________________________
genFunc : 12.939494802034947 =>
I use a small function
start = time.clock()
And how much time is spent
elapsed = time.clock() - start
For some reason, different execution times in the console and IDE
Why does the speed of performance of functions differ depending on where they are launched?
If I run in the console - program runs faster than in IDE (I use Wing IDE)
Example.
Execution time in console:
3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40)
_________________________________
forLoop : 1.8672226498562265 =>
_________________________________
listComp : 1.0452214996682148 =>
_________________________________
mapCall : 0.5306503870825039 =>
_________________________________
genExpr : 1.427833488166335 =>
_________________________________
genFunc : 1.4664546781685468 =>
Execution time in IDE:
3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40)
_________________________________
forLoop : 4.45649404998894 =>
_________________________________
listComp : 1.9458866622428665 =>
_________________________________
mapCall : 0.5576458305684584 =>
_________________________________
genExpr : 12.455734571997347 =>
_________________________________
genFunc : 12.939494802034947 =>
I use a small function
def timer(func, *pargs, **kargs): start = time.clock() for i in repslist: ret = func(*pargs, **kargs) elapsed = time.clock() - start return (elapsed, ret)Start of program execution
start = time.clock()
And how much time is spent
elapsed = time.clock() - start
For some reason, different execution times in the console and IDE