[tarantool-patches] Re: [PATCH v2 1/2] buffer: port static allocator to Lua

Konstantin Osipov kostja at tarantool.org
Mon May 20 12:06:34 MSK 2019


* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/05/19 01:15]:
> Static allocator gives memory blocks from cyclic BSS memory
> block of 3 pages 4096 bytes each. It is much faster than
> malloc, when a temporary buffer is needed.
> 
> This commit exposes the allocator to Lua, which suffers from
> lack of ability to pass values by pointers into FFI functions,
> nor has a stack to allocate small buffers like 'char[256]'.
> Also these allocations complicate and slow down GC job.
> 
> Static allocator solves most of these problems provindg a way to
> swiftly allocate temporary memory blocks.
> 
> A simple micro benchmark showed, that ffi.new() vs
> buffer.static_alloc() is ~100 times slower, even on small
> allocations of 1Kb, and ~1.5 times slower on tiny allocations
> of 10 bytes. The results do not account GC. It is remarkable,
> buffer.static_alloc() speed does not depend on size, while
> ffi.new() strongly depends.

LGTM.


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32




More information about the Tarantool-patches mailing list