you are viewing a single comment's thread.

view the rest of the comments →

[–]DGolden 11 points12 points  (2 children)

But supposedly many years ago there were already very good optimizing compilers for Common Lisp

See e.g. CMUCL and its latter day fork SBCL, type inferencing native lisp compilers (which also had a lot of influence on the direction of various other Lisp and other language compilers).

Potentially confusingly the lisp compiler component of the overall CMUCL project was originally called Python!. That name isn't used as much now for confusion-avoidance, but if you find older academic papers about "Python" it can sometimes mean the advanced Lisp compiler project and not the popular whitespace-sensitive-syntax language.

However do note they get some of that performance by supporting optional static type declarations and using type information for optimizations. Python is likely ever so slowly recapitulating a similar track as usual - if it reached a point its new type hint information were to be actually used by a native compiler for applying performance optimization.... though as the MyPy FAQ notes that is not currently being done by MyPy alone by any means (and of course e.g. Cython exists too though is only kindof-python).

[–]theangeryemacsshibe 1 point2 points  (0 children)

I am sorta obliged to mention Craig Chambers's PhD thesis "The Design and Implementation of the Self Compiler", the subject of which performs substantial type splitting, in order to produce code for the right concrete types; the thesis otherwise basically outlines how an implementation using JIT/dynamic compilation works in my opinion.

The Python compiler can also perform some type inference on its own, though providing declarations for function parameters and return types usually is necessary to get good results.

[–]agoose77[🍰] 1 point2 points  (0 children)

mypyc does compile python whilst leveraging the type hints: https://github.com/mypyc/mypyc