A thought about the popularity of server-side JavaScript

January 20, 2014

One of the things going on these days is that an increasing amount of server-side web related programming is being done in JavaScript, specifically in node.js. Various sorts of people have various reactions to this, some of them negative. I've got some half-formed thoughts about this from an outsider's perspective, but for today I want to stick to one observation that stands out:

Node.js JavaScript is likely the fastest dynamically typed language that you can use on Unix today.

If you want dynamically typed plus speed, your options are not great on Unix right now. Straight Ruby, Python, and Perl do not really cut it. You could try JRuby or Jython to see if the JVM speed for Java has rubbed off on them, but that requires diving into the complexity swamp of the JVM and those implementations are somewhat second class citizens of those languages. Otherwise, for real speed you are looking at a statically typed compiled language: Java, C/C++, maybe Go.

(And the environment you get with node.js is attractive beyond simply speed. Node.js gets you a dynamically typed language on Unix that uses a world-class JIT engine for speed, is quite popular and thus well supported, and that has what I understand is an excellent ecology of packages for doing various things. It doesn't require compilation and has a repl for on the fly exploration. It just requires you to write JavaScript.)

PS: If you look really hard there is probably another dynamically typed language that runs on Unix and does so as fast as node.js (I suspect that there are some Lisp implementations that are in the same ballpark). But I don't think there will be anything that's anywhere near as well known or popular as node.js. And frankly that makes node.js a much safer choice.

Comments on this page:

By Pete at 2014-01-20 10:38:00:

You forgot about Pypy.

By cks at 2014-01-20 13:47:06:

My experiments with PyPy have left me feeling that for a lot of code, PyPy will not be a clear speedup win and especially not a major one. Partly this is because of its raw speed characteristics and partly this is because PyPy clearly requires you to trade off a lot of memory for that speed; in many environments today that is not necessarily a good or desirable tradeoff. So overall I don't think it's going to be anywhere near close to decent node.js JavaScript.

(I could be wrong here, I haven't tried benchmarking node.js. But node.js has a lot more work behind the JIT and behind performance focused programming than PyPy does.)

By Maks at 2014-01-21 23:13:13:

I really like Node but to be fair you forgot about Lua or specifically LuaJit. Still as you say when you add npm into the mix, Node really is way ahead.

Written on 20 January 2014.
« Some thoughts on structured logging, especially in and for databases
Fake versus real metaclasses and what a fully functional metaclass is »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Jan 20 01:48:33 2014
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.