lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 17 September 2010 05:03, sagasw <> wrote:
> I find node.js is very interesting, it seems very useful for high
> performance server programming.

I agree, I've used it occasionally. However most of the time I do the
same kind of thing in Lua.

> But I check the code of node.js, it all writes with C code, and
> node.js almost write everything from scratch.

Actually it's also quite a bit of plain Javascript code too, and
JITted through the V8 engine. Note well... V8 is not LuaJIT :)

Node gets a lot of hype because it's using Javascript, one of the most
widespread languages there is at the moment - very popular among the
"Web 2.0" and startup crowd especially. It brings this group of people
performant server-side development, which before Node would have been
a concept that sounded pretty far-fetched to them.

> Now I have a question. Lua should be able to use in server too, and
> could use libevent/libev as I know,
> How about the performance that use Lua libevent compare with node.js?
> Is it possible that port node.js to Lua? or just use node.js with Lua?

I wouldn't port it directly. I did have the idea that it would be nice
to call into Lua from Node, but I think that's a different issue.

A couple of years back I started the Prosody XMPP server project.
Obviously we're very interested in performance (primarily
latency/throughput and RAM usage). Over time we've developed a set of
libraries at Prosody's core that are applicable to network servers
(and often clients), and we're always optimising them and what not.
It's happened that we now have APIs that do just about anything Node
does (and a few more, like internally joining connections with a
fixed-size intermediate buffer - useful in proxying). I'm also not at
all displeased with the performance, and while you can never have
enough speed, I'm quite satisfied. I've never compared the performance
to Node - I should port the Prosody core to Javascript and test it :)

Whenever I start a new project I now end up pulling in many of these
libraries from Prosody, and I've thought for a while that it would be
good to release them separately. As usual time has stood in the way,
but if there's enough interest and poking then perhaps I'd get around
to it. In the meantime feel free to poke around (particularly net/server*.lua, the core
libs that originally came from the author of the luadch project).

Feel free to contact me off-list if you have any questions.