[Python-3000] Function call speed (Was: Cleaning up argument list parsing)

Guido van Rossum guido at python.org
Tue Apr 18 00:32:38 CEST 2006


On 4/17/06, Paul Moore <p.f.moore at gmail.com> wrote:
> How slow *are* function calls? There seems to be a common "function
> calls in Python are slow" meme. It's never been a significant issue
> for me, but my code is pretty much always IO-bound, so that doesn't
> surprise me. Are they slow enough to warrant serious effort to speed
> them up?

Depends on what you are doing whether it matters, but function calls
are most surely slow. Almost any time where code is CPU bound (and
you've already done all the obvious optimizations), profiling shows
that function calls take up a significant amount of time. Inlining
code obviously addresses this, but that's often killing code
structure.

> More specifically (and more on-topic :-)) is there any room for
> speeding up function calls in Python 3000? Given that pure performance
> improvements are clearly OK for 2.x, I'm thinking of cases where it
> would be necessary to impose language-level restrictions to ease the
> optimisation process.

I definitely don't want to make optimization a goal of Python 3000. At
the same time I don't want it to be *slower* than Python 2.x. So if at
some point it appears to be getting slower (it's way too soon to tell)
we may have to do some optimization work just so that people can't
reject it on the basis of the relative speed alone.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list