Calling a function is faster than not calling it?

Skip Montanaro skip.montanaro at gmail.com
Mon May 11 11:13:39 EDT 2015


On Mon, May 11, 2015 at 10:01 AM, BartC <bc at freeuk.com> wrote:
> (1) It has an extra argument ('code'), in addition to any normal arguments
> of func (0 in this case)

Which might well push execution down the unoptimized code path. Also,
ISTR that Steven's original timeit runs tacked on a standalone "eval ;
..." to the function call case, so the LOAD_GLOBAL bytecode would have
been done in the function call case as well. He was, I think, doing
what he could to make the two cases as nearly identical as he could.

Skip



More information about the Python-list mailing list