loop in python
daniel.dittmar at sap.corp
Mon Aug 22 17:26:06 CEST 2005
> Why is it that the implementation of empty loop so slow in python when compared to perl ?
> Is python runtime slow at all aspects when compared to perl ?
> I really wonder what makes python slower than perl ?
It could be that the Perl compiler recognizes such a for loop and emits
special code (e.g. an integer loop variable that gets incremented).
Python creates an xrange object and then has the overhead of 1000 next()
You should benchmark other features before jumping to conclusions: calls
to functions, calls to methods, calls to inherited methods.
Others will probably chime in with arguments whether such micro
benchmarks are a useful indication of the speed a complete program at all.
> Is there any proposal to make python faster in future versions ?
Yes in the general case, probably no in this specific case.
More information about the Python-list