faster-cpython / ideas

1.68k stars 48 forks source link

Is it possible to implement automatic function inlining in CPython? #636

Closed bobqianic closed 10 months ago

bobqianic commented 10 months ago

In Python, every function call has a very significant overhead. I know Python is a dynamic language, but is it possible to implement automatic function inlining in CPython? I'm not very familiar with CPython, and my question might be a bit naive. Please understand. Thank you!

gvanrossum commented 10 months ago

It would be better to ask your question on a user forum, maybe the help or ideas category on discuss.python.org. Note that this tracker is mostly used for discussing advanced ideas for optimizing Python. In that context, it's likely that eventually some functions will automatically inlined.