Le mer. 23 sept. 2020 à 13:49, Ivan Levkivskyi <levkivskyi@gmail.com> a écrit :
Sure, but JIT optimizations assume there are some "hot spots" in the code where e.g. a function is called in a loop, so that type information can be gathered and re-used. The problem is that in my experience there are many applications where this is not the case: there are no major hot spots. For such applications JITs will not be efficient, while static annotations will work.
Another thing is that making CPython itself JITted may be even harder than adding some (opt-in) static based optimizations, but I am clearly biased here.
CPython has a JIT compiler since Python 3.8 :-) When a code object is executed more than 1024 times, a cache is created for LOAD_GLOBAL instructions. The What's New in Python 3.8 entry says that LOAD_GLOBAL "is about 40% faster now": https://docs.python.org/dev/whatsnew/3.8.html#optimizations Victor -- Night gathers, and now my watch begins. It shall not end until my death.