
Love for LuaJIT - whyenot
http://google-opensource.blogspot.com/2010/01/love-for-luajit.html
======
mbrubeck
LuaJIT 2.0 is an amazing achievement. On the programming language shootout's
"flawed benchmarks", LuaJIT outperforms almost every other dynamic language
(including JavaScript V8, Python, Ruby 1.9, JRuby, VisualWorks Smalltalk,
CPython, PLT Scheme), and is competetive on many benchmarks with highly-
optimized language implementations like Sun's JVM, and GHC:

[http://shootout.alioth.debian.org/u32q/which-programming-
lan...](http://shootout.alioth.debian.org/u32q/which-programming-languages-
are-
fastest.php?gpp=on&java=on&csharp=on&ghc=on&sbcl=on&luajit=on&hipe=on&v8=on&vw=on&mzscheme=on&lua=on&python=on&php=on&perl=on&ruby=on&calc=chart)

Mike Pall wrote LuaJIT and now LuaJIT 2 as essentially solo efforts. Thanks to
Google and the other sponsors for helping him continue!

~~~
mikemike
For an apples-to-apples comparison you'll want to look at the single-threaded
performance:

[http://shootout.alioth.debian.org/u32/benchmark.php?test=all...](http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=all)

~~~
aaronblohowiak
Spoiler: LuaJit compares even better when comparing single-threaded
performance.

Edit: replaced "performs" with "compares", eliminating ambiguity around
competitive performance vs clocktime performance

~~~
mikemike
Spoiler: The Lua benchmark submissions are not parallelized.

------
dchest
_We use Lua internally at Google_

Interesting! Anyone know details?

~~~
whyenot
Joshua Haberman gives some details here:
<http://article.gmane.org/gmane.comp.lang.lua.general/62321>

_Our Lua usage isn't too widespread at the moment; it's really one
infrastructure project in particular that uses Lua to allow user-defined
functions to run within a tightly controlled container. Lua was the best
choice, because of its low overhead, fast execution, and the ability to set
limits on execution time._

 _Unfortunately I cannot be more specific, since the project is not public._

~~~
haberman
Man, you only have to say something once and then the Internet replicates it
for you. :)

~~~
pyre
Well, if there is someone motivated enough to search for it.

~~~
blasdel
and a company with a mandate to publicly index _everything_...

~~~
chancho
...well, almost everything.

------
whyenot
Mike Pall's annoucement on Lua list:
<http://thread.gmane.org/gmane.comp.lang.lua.general/62316>

------
kilowatt
It's been on my todo list to take some time to grok luajit's internals for
awhile. Awesome to see Google parting ways with some cash!

This sort of makes me want to try to write a Python->Lua compiler.

------
fortes
Anyone using Lua for web apps? What's the current state ofthe ecosystem?
Anything good, stable, and easy to deploy?

~~~
lh
That's something I've also been wondering lately, since the Kepler and Orbit
projects haven't seen activity for ages (at least according to their
webpages).

I found this Sinatra clone for Lua called Mercury
(<http://github.com/nrk/mercury>), but it lacks documentation and does not
seem to be very mature at the moment.

~~~
fortes
Yeah, I've poked around a bit as well, but didn't find anything that seemed
like it was getting traction.

I was excited when I heard that mod_lua was going to be included with Apache
by default [1] ... but I haven't really heard anything since then.

[1] <http://news.ycombinator.com/item?id=452396>

------
toisanji
it makes me wonder why languages like ruby are so slow.

~~~
mbrubeck
Ruby _might_ just need a better implementation with more time spent on
optimization. <http://maglev.gemstone.com/> is going in this direction.

But also, Lua was always designed with cleanness and simplicity of
implementation in mind. Its developers have strong backgrounds in both theory
and engineering, which you can see in their interview in the book _Masterminds
of Programming_. They've been very conservative about the design of the
language. In contrast, Ruby feels much messier and more "evolved" - look at
its Yacc grammar[1], for example, compared to the grammar of JavaScript or
Lua[2]. Even the Ruby lexer is full of weird edge cases. Much of MRI is like
that, and for years it was the only "spec" for the language; now its decisions
have been reverse-engineered and inherited by all other implementations.

[1]:
[http://blog.nicksieger.com/articles/2006/10/27/visualization...](http://blog.nicksieger.com/articles/2006/10/27/visualization-
of-rubys-grammar)

[2]: <http://www.lua.org/manual/5.1/manual.html#8>

[By the way, I've used Ruby for years and like it at lot, while I've written
only a few lines of Lua code and like it but am not deeply familiar with it.]

~~~
dchest
Also, "The Evolution of Lua" — an interesting paper that shows how they came
to this fast and somewhat elegant language:
[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72....](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.3859&rep=rep1&type=pdf)
[PDF]

~~~
silentbicycle
Also good: "The Implementation of Lua 5.0" (<http://www.tecgraf.puc-
rio.br/~lhf/ftp/doc/sblp2005.pdf>).

Past discussion: <http://news.ycombinator.com/item?id=617278>

If you want to learn Lua, Ierusalimschy's _Programming in Lua_
(<http://www.inf.puc-rio.br/~roberto/pil2/>) is by far the best book. Lua is
one of my favorite languages. While it's good on its own, you'll get a _lot_
more out of it if you're comfortable with C. Lua+C is an excellent
combination.

~~~
ambulatorybird
Just chiming in as another Lua fan; I really like it because it's like the
Scheme of imperative scripting languages. And while we're passing around links
to papers, I've found the following the be good for additional insight:

Lua Performance Tips: (<http://www.lua.org/gems/sample.pdf>)

A No-Frills Introduction to Lua 5.1 VM Instructions:
([http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLu...](http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLua51VMInstructions.pdf))

------
jawngee
Can't wait for the x64 version.

