

Ask HN: why is js winning the dynamic language performance race? - cageface

I've been quite surprised to see how quickly the performance of the major javascript engines has improved. It went from being a fairly slow language to a language that in its fastest implementations (v8) is significantly faster than python, ruby, perl and php. The teams working on performance for those languages don't seem to have made anything close to the same progress.<p>Why is this? Is JS just an easier language to optimize? Are the JS engine teams just more skilled?
======
cpr
Simply because the new hotness is the browser space (the new operating system
wars), and he with the fastest browser of the moment gets to brag.

It does happen that some of the most skilled virtual machine developers in the
world are working on V8, for example. (Lars Bak is leading their effort, and
he was one of the leads on the Self/Java Hotspot engines, having now built
several generations of optimizers for dynamic languages). This is not a
coincidence. ;-)

And it also happens that, until a little while back when JS performance became
important, the JS engines were pretty backwater-ish, and quite slow. So it's
fairly easy to make important speed gains when starting from such a lowly
position.

~~~
cageface
Yeah obviously JS had a lot of ground to cover. The surprising thing to me is
that they have not only caught up, but _surpassed_ the other dynamic
languages, despite all the engineering effort that's gone into speeding them
up.

I'm sure having somebody with Bak's experience on the job makes a big
difference. The other browser JS implementations seem to be keeping pace
though.

~~~
chromatic
_... despite all the engineering effort that's gone into speeding them up._

Implementing and optimizing a language are big projects. They benefit a lot
from sponsors. See Sun, IBM, Microsoft, Mozilla, Google, and Opera. (I don't
know of a single company which has sponsored LuaJIT, but it's worth
mentioning.)

~~~
mikemike
<http://luajit.org/sponsors.html>

~~~
cageface
Interesting to see google on the sponsor list.

Blizzard should kick down something. They've made a fortune off lua.

------
PassTheAmmo
Lua is still beating v8 rather handily though.
[http://shootout.alioth.debian.org/u32/benchmark.php?test=all...](http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=v8&lang2=luajit)

~~~
cageface
Yeah Lua bucks the trend. Maybe it's just a matter of the experience and skill
of the team and not the number of man-hours dumped into it?

Maybe it's a little bit like writing graphics drivers, just one of those
things that only a small handful of people can really do well.

~~~
Twisol
I remember reading something about how JavaScript has so many backwards-
compatibility edge cases that it's extremely difficult to write a performant
engine. Unfortunately I can't find my source.

Lua has the turtle's mindset. It's gone slow and steady, and its releases are
anything but frequent. However, that just goes to show how stable of a product
it is.

(Considering the context, maybe a turtle wasn't the best comparison...)

