lua-users home
lua-l archive

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


2011/2/16 Francesco Abbate <francesco.bbt@gmail.com>:
> Well, of course it is possible to do another benchmark but what I
> understood about LuaJIT2 vs JavaScript V8 is that, as soon as there is
> any important pressure to the GC with a ton of small objects the GC
> will became dominant and JavaScript V8 will win because they have
> probably a better GC.

the JavaScript code had an array definition with fixed size (screen
size), whilst in the lua raytracer the dynamically growing table was
used to store the content. That was a key bottle-neck.

javascript:
map.pixels = new Array(map.width * map.height)
map.pixels[index] = color

lua:
pixels = {}
for each pixel
  pixels[index] = color
  index++