performance critical Python features

E

Eric Snow

I was thinking about the different features of Python that have an
impact on performance. Here are the obvious ones I could think of:

Features most impactful on performance:

- function calls
- loops

Features least impactful on performance:

- imports
- function definitions
- class definitions

A key point is that CPython has special-case optimization for
functions (code objects, locals, and eval) and loops (comprehensions,
generators, and iterators). Also, other libraries are optimized via
C-extensions to be efficient, I expect due to their use in loops. In
contrast to that, the machinery behind language features like imports
are moving to pure Python.

So, which are the other pieces of Python that really need the heavy
optimization and which are those that don't? Thanks.

-eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top