[Python-Dev] Python 3 optimizations continued... (original) (raw)

Guido van Rossum guido at python.org
Thu Sep 1 19:40:00 CEST 2011


On Thu, Sep 1, 2011 at 10:15 AM, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:

On Sep 1, 2011, at 5:23 AM, Cesare Di Mauro wrote: A simple solution: when tracing is enabled, the new instruction format will never be executed (and information tracking disabled as well). Correct me if I'm wrong: doesn't this mean that no profiler will accurately be able to measure the performance impact of the new instruction format, and therefore one may get incorrect data when on is trying to make a CPU optimization for real-world performance?

Well, profilers already skew results by adding call overhead. But tracing for debugging and profiling don't do exactly the same thing: debug tracing stops at every line, but profiling only executes hooks at the start and end of a function(*). So I think the function body could still be executed using the new format (assuming this is turned on/off per code object anyway).

(*) And whenever a generator yields or is resumed. I consider that an annoying bug though, just as the debugger doesn't do the right thing with yield -- there's no way to continue until the yielding generator is resumed short of setting a manual breakpoint on the next line.

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list