John Nagle wrote:
Steven D'Aprano wrote:

   Take a good look at Shed Skin.  One guy has been able to build a system
that compiles Python to C++, without requiring the user to add "annotations" about types.

In *only* compiles a subset of Python, as does Cython. Both cannot (currently) do generators, but that can be done and probably will eventually at least for Cython. Much as I love them, they can be rewritten by hand as iterator classes and even then are not needed for a lot of computational code.

I think both are good pieces of work so far.

>  The system uses type inference to figure it out itself.
You give up some flexibility; a variable can have only one primitive type
in its life, or it can be a class object.  That's enough to simplify the
type analysis to the point that most types can be nailed down before the
program is run.  (Note, though, that the entire program may have to
be analyzed as a whole.  Separate compilation may not work; you need
to see the callers to figure out how to compile the callees.)

   It's 10 to 60x faster than CPython.

   It's the implementation, not the language.  Just because PyPy was a
dud doesn't mean it's impossible. There are Javascript JIT systems
far faster than Python.

   Nor do you really need a JIT system.  (Neither does Java; GCC has
a hard-code Java compiler.  Java is JIT-oriented for historical reasons.
Remember browser applets?)  If you're doing server-side work, the
program's structure and form have usually been fully determined by
the time the program begins execution.

                    John Nagle

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to