So I went back and revised my idea for inline functions in python, and I
realized that it would be harder to implement them in python the way I had
originally thought about them, due to Python’s dynamic nature. However, the
idea itself doesn’t seem so original, as Cinder already implements inline
byte-code caching which significantly boosts its performance. I do not think
they ever upstreamed these changes however.
So a modification of my idea goes like this. The inline functions can still be
written with the inline keyword, but evaluated at runtime. This is because
there are some cases such as in conditions where are function might never be
called at all, so it wouldn’t need to be optimized in that case
so in cases where someone writes code like,
if True:
inline def func_version_one(*args):
#func body
pass
else:
inline def func_version_two(*args):
#func body
pass
The right function to perform inlining on shall be determined at runtime and
cached in the same scope as where it’s performing it’s operations from cases
where the program performs large iterations or even in infinite loops and other
cases that need optimization.
Like I said before, it’s still a work-in-progress, and I’m still putting lots
of factors into consideration, including your incredible insight as the core
dev team.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/J44HVJLGKYA4I62WJDQTUZCOUQI2IU2H/
Code of Conduct: http://python.org/psf/codeofconduct/