Skip to content

bpo-44525: Specialize calls to normal python classes - #30415

Closed
markshannon wants to merge 7 commits into
python:mainfrom
faster-cpython:specialize-calls-to-normal-python-classes
Closed

markshannon wants to merge 7 commits into
python:mainfrom
faster-cpython:specialize-calls-to-normal-python-classes

Conversation

@markshannon

@markshannon markshannon commented Jan 5, 2022 •

Copy link
Copy Markdown
Member

Specializes calls to "normal" Python classes. That is, classes that inherit from object or other "normal" classes and do not override __new__.

The specialized form creates the object (self) pushes a shim frame to replace the result of __init__ with self and jumps into __init__.

Provides a ~1% speedup

https://bugs.python.org/issue44525

@markshannon

Copy link
Copy Markdown
Member Author

This needs one or two additional checks that the __init__ function's code object is of the correct form.

@markshannon

Copy link
Copy Markdown
Member Author

I'm closing this in favor of a two part specialization approach. See faster-cpython/ideas#210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants