[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Luvit - Lua + UV + Jit = NodeJS re-implemented in Lua
- From: Tim Caswell <tim@...>
- Date: Thu, 1 Dec 2011 08:03:24 -0600
On Thu, Dec 1, 2011 at 7:51 AM, Dieter Plaetinck <dieter@plaetinck.be> wrote:
> On Wed, 30 Nov 2011 12:56:57 -0600
> Tim Caswell <tim@creationix.com> wrote:
>
>> If you're familiar with nodejs, it's quite similar (...)
>
> it looks very cool, but i have to ask: why?
> is there anything about lua that makes it more appropriate to build this kind of technology vs javascript?
> anything with speed, reliability, available libraries? language features?
> or the fact that lua is a smaller language with a simpler implementation, and hence easier to work with to build this?
>
> on your github page I read "In initial benchmarking with a hello world
> server, this is between 2 and 4 times faster than nodeJS."
> do you know why this happens? can we conclude the lua jit runtime is just more efficient than js?
> (http://luajit.org/luajit.html also mentions something like that)
As I mentioned on the nodeJS mailing list:
http://comments.gmane.org/gmane.comp.lang.javascript.nodejs/32664
1. Lua is not JavaScript. It's pretty darn close and I like both for
unique reasons, but JavaScript is *far* more popular due to this thing
we call the internet.
2. V8's JS to C++ conversion is really slow compared to luajit's Lua
to C layer. Also V8 uses a lot more ram and starts up much slower.
3. Co-routines in Lua are really nice and with very little extra
sugar make a simple, obvious, and effective way to write sync style
code while living in an async world.
Because of discovery #1, I don't think Luvit will ever become more
popular than nodeJS, especially for anything web related. I see Luvit
being used for things like mobile devices where performance *really*
matters, JIT can be disabled (think iOS), and the built-in FFI makes
SDL and openGL possible without bindings.
I don't think it's fair or accurate to say that Luajit runs Lua faster
than V8 runs JavaScript. It's much more complicated than that.
Besides, in a Luvit program, most the time is not spend executing Lua
code, it's making sys calls. Just for fun I benchmarked Luvit with
and without Jit and it made only a 2% speed difference in the
benchmark.
-Tim Caswell