pointless musings on performance
Antoine Pitrou
solipsis at pitrou.net
Tue Nov 24 13:25:37 EST 2009
Le Tue, 24 Nov 2009 08:58:40 -0800, Paul Boddie a écrit :
> As you
> point out, a lot of this RISC vs. CISC analysis (and inferences drawn
> from Python bytecode analysis) is somewhat academic: the cost of the
> JUMP_IF_FALSE instruction is likely to be minimal in the context of all
> the activity going on to evaluate the bytecodes.
Sorry, I have trouble parsing your sentence. Do you mean bytecode
interpretation overhead is minimal compared to the cost of actual useful
work, or the contrary?
(IMO both are wrong by the way)
> I imagine that someone (or a number of people) must have profiled the
> Python interpreter and shown how much time goes on the individual
> bytecode implementations and how much goes on the interpreter's own
> housekeeping activities.
Well the one problem is that it's not easy to draw a line. Another
problem is that it depends on the workload. If you are compressing large
data or running expensive regular expressions the answer won't be the
same as if you compute a Mandelbrot set in pure Python.
One data point is that the "computed gotos" option in py3k generally
makes the interpreter faster by ~15%. Another data point I've heard is
that people who have tried a very crude form of Python-to-C compilation
(generating the exact C code corresponding to a function or method, using
Python's C API and preserving dynamicity without attempting to be clever)
have apparently reached speedups of up to 50% (in other words, "twice as
fast"). So you could say that the interpretation overhead is generally
between 15% and 50%.
More information about the Python-list
mailing list