PyCon Redux
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

Performance Antipatterns

Microsoft has a team working on making Python faster (over 25% for Python 3.11), called the “Faster CPython” team. Brandt Bucher (gave the match statement talk) and Anthony Shaw (gave this talk) are both team members.

A savvy point made is to only optimize when there’ll be a > 10% performance gain, otherwise observed improvement may just be CPU noise. This talk will teach you about speed: using __slots__, not using dataclasses, and removing helper functions. It also suggests multiple tools:

  • The memory profiler Scalene
  • For immediate huge performance gains, just switch Python interpreter: Pyston (maintainer Kevin Modzelewski gave the performant code talk), Cython (called “cythonizing”), or PyPy (JIT)