Hacker News new | comments | ask | show | jobs | submit login

So some Node written by a self-confessed Node novice, based on a 'hello world' example, and running on an old(ish) verson of Node is actually quite similar in performance terms compared to TCL written by someone who knows how to write a TCL server from scratch. That is not a reasonable comparison. Get someone with some Node experience to write the Node server, then compare them.

He uses the Hello World code from http://howtonode.org/hello-node so he did not write the Node version.

The point it that he's comparing his TCL code (which is as fast as he could be bothered to make it) to a 'hello world' tutorial that was written as an introduction to Node, not as anything that was designed to demonstrate Node is in any way fast.

The 'hello world' example is a good comparator: Presumably the Node developers have optimised the `http` library as much (if not more) than the author's Tcl equivalent. Given that they are therefore doing the same thing, it seems a fair test. Beyond forking new Node processes to handle more requests, I don't think you could make it faster (likewise with the Tcl version).

That said, while it's a fair test, I don't think it's a particularly useful one. It would be interesting to see how the two compete when they do something equivalent but non-trivial.

I suspect that for something non-trivial, it will depend on what you are doing. TCL is slow at most things, has fast string manipulation and very fast regular expressions. TCL also makes it easy to write some C to do your heavy lifting, which could be very fast indeed. On the other hand it lacks libraries for async database access etc.

It was not meant to be more than a limited test of the TCL event loop and my code.

Node's regular expression engine will run circles around almost every other language implementation out there.[0] This is thanks to Google's work on V8.[1] Regexes are, maybe surprisingly, one of the few things that Node is good at.

[0] http://benchmarksgame.alioth.debian.org/u32/performance.php?...

[1] http://blog.chromium.org/2009/02/irregexp-google-chromes-new...

Nothing really surprising here.

Regexes are the only way to do more advanced text manipulation in JavaScript, so they're being used far more than in other languages. Lua is similar here, having only a couple most basic string operations built-in and relying on regexes for anything even slightly more advanced. This makes it natural for these languages' implementations to focus heavily on optimizing regexes.

Also, regexes are easily JITable and of course implementations having a JIT are going to be much more performant than normal interpreters. This explains the results of your [0] - I didn't check, but I suppose it's a vanilla Lua interpreter and not LuaJIT.

I did not know that V8 was that good as regexes. TCL is very fast, but it is quite likely that Node is faster.

On the other hand, I think the point that real world performance will depend on the task in hand stands.

Yeah, even for a benchmark it isn't that good, but I still get sad when I'm reminded that Tcl had all this event-loopy stuff thats' the selling point of Node for years and years. So much wasted opportunity with that language...

How much could you optimize a "hello world"!

I was never all that great a TCL programmer - it was the first language I did any real work in, and I had quite limited experience at the time I wrote that.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact