Python's biggest compromises

John Roth newsgroups at jhrothjr.com
Fri Aug 1 06:44:08 EDT 2003


"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message
news:23bcqKAykjK$Ewhy at jessikat.fsnet.co.uk...
> In article <mailman.1059707762.24307.python-list at python.org>, Ian
> Bicking <ianb at colorstudy.com> writes
> >And Java's JIT is based on (at least originally) work done on Self,
> >which had to do type inference.  And actually in many circumstances Java
> >requires type inference, because you can substitute in an instance of a
> >subclass.
> >
> >Anyway, JIT is all about runtime analysis -- if you could infer types
> >completely before running the program, you would just put in the
> >optimizations statically (i.e., compiling optimizations).  JIT does
> >those optimizations at runtime by definition.
> >
>
> but Java does at least require specifying every type and that must at
> least cut down on the amount of work required.
>
> >And Bicycle Repair Man is inspired by the Refactoring Browser, an IDE
> >tool based on another dynamic language (Smalltalk), not on a tool from a
> >static language (like Java).
> >
> >  Ian
>
> I don't have any data here, but I believe Python is just a little too
> weakly typed for compiling to float*float type assembler efficiently.

The trick with JITs is that they don't depend on absolute type
consistency. They depend on the observation that 99.44% of your
code is type consistent, and that consistency will turn up at run time. So
the code they generate depends on that discovered consistency, and
checks in front of each section to discover if the types are what the
code expects.

If it is, they execute it, if it isn't, they abandon it and go back to
the intepreter to discover what happened.

John Roth
> -- 
> Robin Becker






More information about the Python-list mailing list