I'm still playing with some benchmarks, mostly from the shootout. I made
a tentative implementation of a file_read_line function in neko's std
lib, which allowed me to write a File iterator for haXe.
http://shootout.alioth.debian.org/debian/benchmark.php?test=sumcol&lang=gcc
file_read_line in C is implemented a lot more trivialy.
It's not "correct" since it limits the line size to 128 but it seems
acceptable for the shootout.
Other thing, it that you're not benchmarking Neko there, but haXe.
There's additional things done in haXe :
- wrapping the Neko string into the object String
- iterators
You could remove the second overhead by writing for instance the following :
var s = 0;
try {
while( true )
s += Std.parseInt(f.readLine());
} catch( e : Dynamic ) {
neko.Lib.print(s);
}
However this benchmark will show almost nothing since it might be mainly
IO-bound. Lua and Python have the same results and are "just" 3.5 time
slower than pure C.
As far as benchmarking is concerned, neko feels on par with Python,
which is to say not very fast compared to VM based language like Java or
even Lua. Lua is certainly the fastest interpreted language there is.
It depends a lot what you're benchmarking and how. The main difference
between Lua and Neko VM are :
a) Neko has different data structures (object, array, string, integer)
with different representations, this should perform better and allow
more strictly typed program
b) I think Lua VM is using threaded code optimizations (only available
on GCC) which can speedup opcode dispatching by 50%. It has not been
added on Neko yet.
On which platform are your running your benchmarks ? Which which
compiler did you compiled Neko ?
I'm still playing with these not so serious benchmarks to get a feel of
the platform's strengths and weaknesses, right now I'm a little
surprised not to see any gains over Python...
If you post your code and results, I'll have a look and try to explain
why. Neko might indeed need some optimizations, but they will come with
JIT this summer. Keep your benchmarks so you can run them again at this
time ;)
Best,
Nicolas
--
Neko : One VM to run them all
(http://nekovm.org)