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

Steve D'Aprano steve+python at pearwood.info
Tue Apr 18 11:33:22 EDT 2017


On Tue, 18 Apr 2017 03:43 pm, Gregory Ewing wrote:

> Steve D'Aprano wrote:
>> I'm not sure why the Cython devs maintain this is not a JIT compiler.
>> Perhaps I misunderstand something.
> 
> A JIT compiler works by observing the actual values taken on
> by variables at run time, and if it notices that a particular
> variable seems to always have a particular type, it compiles
> a special version of the code to handle that type, protected
> by appropriate guards.

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

> 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.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.



More information about the Python-list mailing list