Lua is faster than Fortran???

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Jul 4 00:15:57 EDT 2010


On Sat, 03 Jul 2010 20:30:30 -0700, sturlamolden wrote:

> I know it's "just a benchmark" but this has to count as insanely
> impressive. Beating Intel Fortran with a dynamic scripting language, how
> is that even possible? 

By being clever, using Just In Time compilation as much as possible, and 
almost certainly using masses of memory at runtime. (The usual trade-off 
between space and time.)

See the PyPy project, which aims to do the same thing for Python as Lua 
have done. Their ultimate aim is to beat the C compiler and be faster 
than C. So far they've got a bit to go, but they're currently about twice 
as fast as CPython.


> And what about all those arguments that dynamic
> languages "have to be slow"?

They're bullshit, of course. It depends on the nature of the dynamicism. 
Some things are inherently slow, but not everything.

Fast, tight, dynamic: pick any two.


> If this keeps up we'll need a Python to Lua bytecode compiler very soon.

"Need" is a bit strong. There are plenty of applications where if your 
code takes 0.1 millisecond to run instead of 0.001, you won't even 
notice. Or applications that are limited by the speed of I/O rather than 
the CPU.

But I'm nitpicking... this is a nice result, the Lua people should be 
proud, and I certainly wouldn't say no to a faster Python :)

[...]
> The only comfort for CPython is that Ruby and Perl did even worse.

It's not like this is a race, and speed is not the only thing which a 
language is judged by. Otherwise you'd be programming in C, not Python, 
right?


-- 
Steven



More information about the Python-list mailing list