lua-users home
lua-l archive

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


Luís Eduardo Jason Santos wrote:
> Does anyone knows why the binarytrees benchmark on [1] doesn't have the
> usual 'killing machine' performance one could expect from Lua?

All the other language implementations either use a bump allocator
with a generational GC or a dedicated pool allocator.

Lua uses plain malloc(). LuaJIT 2.0 uses its own allocator and
colocated allocation for small arrays. As you can see the latter
is 3x-4x faster in this case (the benchmark is still interpreted
in the latest beta release).

But neither is a substitute for a bump allocator. Unfortunately,
using such an allocator implies the need for a moving GC. The
current Lua GC is non-moving. Revising this fundamental design
choice is very complicated while keeping the current Lua/C API.

In the long run this will always be a benchmark where Lua will not
be competitive. But such a high allocation rate is quite unusual
for most real-world Lua programs, anyway.

--Mike