[Python-Dev] Re: Annotating pure functions to improve inline caching/optimization

2022-09-19 Thread Philipp Burch
Hi Ken, thank you for the inputs. Just one more comment: I actually find myself often factoring such data out of loops in Python, whereas in C I would just leave that to the optimizer/compiler. The compiler in CPython can't really do that because it's not safe in Python. The user could've

[Python-Dev] Re: Annotating pure functions to improve inline caching/optimization

2022-09-19 Thread Philipp Burch
On 15.09.22 00:05, Jeremiah Gabriel Pascual wrote: I've frequently explored the new adaptive, inline caching code generated by 3.11. "inline caching" does not mean result caching (like what C/C++ might do) here, but rather it should mean the caching of info used for the adaptive instructions.

[Python-Dev] Re: Annotating pure functions to improve inline caching/optimization

2022-09-19 Thread Ken Jin
Hi Phillip, thanks for your interest in CPython. How Python views your code isn't how you view your code. CPython views source code instead as something called "bytecode/wordcode". This bytecode is a lower-level intermediary language that the CPython interpreter executes. You can read more

[Python-Dev] Re: Annotating pure functions to improve inline caching/optimization

2022-09-14 Thread Jeremiah Gabriel Pascual
> I wonder how this caching works, given that the dynamic nature means > that virtually every operation could have side effects, causing wrong > behaviour when cached. The only mitigation for this that I can imagine > is that caching just occurs for basic operations defined in the standard >

[Python-Dev] Re: Annotating pure functions to improve inline caching/optimization

2022-09-14 Thread Eric V. Smith via Python-Dev
You should bring this up on discuss.python.org. It's not going to see much if any discussion here. Eric On 9/14/2022 10:05 AM, Philipp Burch wrote: Hello everyone, the docs on the upcoming 3.11 release state > This [specializing adaptive interpreter] also brings in another concept called