lua-users home
lua-l archive

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


> Hi list,
> 
> I have been working in the past years on the Neko VM (http://nekovm.org)
> which share similar goals with Lua. I was interested in comparing the
> different choices made by the two VM and how they can impact the
> performances, so I wrote a comparison report available there :
> 
> http://nekovm.org/lua

Wow. Looks like this thread turned into something that was not expected,
especialy since the comparison was analyzing different things but NOT
syntax.

Syntax is overrated. What is important for a language are its semantics
and the implications on its compiler/runtime implementation, which was
the original focus of the Lua/Neko comparison.

So far, I can answer a few questions that were posed :

- copying ensure better locality but as a drawback : values does not fit
in a register, which is pretty problematic when writing a JIT. Also, a
single integer takes 12 bytes in Lua while it takes 4 bytes in Neko.
Comparing the pro and cons of both approachs is pretty difficult, and
might depends on the program that runs on the VM.

My main interest is compiler optimization, since both Neko and NekoML
compilers are running on the VM itself with pretty good performances.
And since Neko compiler is functional, locality is somehow helped by
manipulating mostly immutable data structures. Also, since cache misses
are a big bottleneck, CPU caches are being increased to compensate this
problem.

- Neko has a C FFI that supports callbacks (see http://neko.org/ffi) and
is used as runtime for several languages, in particular haXe
(http://haxe.org) that - disclaimer - I have been also developping.

- it could be interesting to compare Neko and Javascript but since there
are several JS implementations that would be more difficult to do. I
added JS to the FAQ together with PHP and Ruby.

- arrays and strings are not resizable in Neko itself. But you can
create OO APIs around them that has a Neko array reference that changes
when resizing is needed.

It seems that I didn't get so many comments from Lua "wizards" that know
about the implementation details. I would be also interested in
benchmarking the two VM with realistic samples.

Best,
Nicolas