Lua is faster than Fortran???

John Nagle nagle at animats.com
Sun Jul 4 16:58:17 EDT 2010


On 7/4/2010 12:51 PM, Luis M. González wrote:
>> Looking at median runtimes, here is what I got:
>>
>>     gcc               1.10
>>
>>     LuaJIT            1.96
>>
>>     Java 6 -server    2.13
>>     Intel Fortran     2.18
>>     OCaml             3.41
>>     SBCL              3.66
>>
>>     JavaScript V8     7.57
>>
>>     PyPy             31.5
>>     CPython          64.6
>>     Perl             67.2
>>     Ruby 1.9         71.1
>>
>> The only comfort for CPython is that Ruby and Perl did even worse.

    It's embarrassing that Javascript is now 9x faster than Python.
Javascript has almost all the dynamic problems that make CPython
slow, but they've been overcome in the Javascript JIT compiler.

    Here's how the Javascript V8 system does it:

	http://code.google.com/apis/v8/design.html

They get rid of unnecessary dictionary lookups for attributes by
automatically creating "hidden classes" which, in Python terms, use
"slots".  If an attribute is added to an object, another hidden class
is created with that attribute.  Each such class is hard-compiled
to machine code while the program is running.  So attribute access
never requires a dictionary lookup.  Adding a new, not-previously-used
attribute is a relatively expensive operation, but with most programs,
after a while all the new attributes have been added and the program
settles down to efficient operation.

    That's in Google's Chrome browser right now.

    The Unladen Swallow people should in theory be able to reach
that level of performance.  (Both groups are employed at Google.
So their effectiveness will be compared.)

				John Nagle





More information about the Python-list mailing list