3 ms·
From some searching, this apparently is easier said than done[1] (read: there doesn't appear to be a way to guarantee that the decorator wouldn't break due to v
by e12e 11y ago
From some searching, this apparently is easier said than done[1] (read: there doesn't appear to be a way to guarantee that the decorator wouldn't break due to various meta-programming etc).
Relevant links:
The RPython sub-set used to implement pypy (and other languages on the rpython run-time) has a decorator for @always_inline, and does automagic inlining:
https://mail.python.org/pipermail/pypy-commit/2014-November/086702.html https://mail.python.org/pipermail/pypy-commit/2014-November/...
http://rpython.readthedocs.org/en/latest/translation.html#function-inlining http://rpython.readthedocs.org/en/latest/translation.html#fu...
I'm not entirely clear on what is being governed by the pypy interpreter inline_trehshold -- if it's for both python code, or just for the interpreter:
http://pypy.readthedocs.org/en/latest/config/translation.backendopt.inline_threshold.html http://pypy.readthedocs.org/en/latest/config/translation.bac...
http://boxbase.org/entries/2015/apr/20/rpython-jit-optimizations/ http://boxbase.org/entries/2015/apr/20/rpython-jit-optimizat...
There's a project to do AST level optimizations at (bytecode) compile time:
https://pypi.python.org/pypi/astoptimizer https://pypi.python.org/pypi/astoptimizer
There's been talk of using a decorator to allow for function inlining:
[1] http://bugs.python.org/issue10399 http://bugs.python.org/issue10399