Static typing [was Re: Python and the need for speed]

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Apr 18 19:32:46 EDT 2017


Steve D'Aprano wrote:

> You seem to be describing a *tracing JIT* compiler.

Well, yes, but it seems to me that a JIT compiler that
*doesn't* use tracing is just an AOT compiler that you
happen to run immediately before executing the program.

>>Cython doesn't do any of that -- it's just a plain, boring,
>>standard ahead-of-time compiler that goes by the type info
>>you give it and nothing more.
> 
> That cannot be the full story, because Cython can optimize some regular,
> unannotated Python code.

Maybe, but the point is that it does it using only
information present in the source. Also, it's usually
run once ahead of time to generate object code that's
stored.

I think we may be using different definitions of "JIT".
If you define it simply as running the compiler just
before you execute the code, then *some* ways of using
Cython might *barely* qualify -- you can set things up
so that a Python import will trigger compiling Cython
code if necessary.

But that doesn't seem like a useful way of defining JIT
to me. Such a compiler is not a different kind of beast
from an AOT compiler.

-- 
Greg



More information about the Python-list mailing list