Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v2 1/2] buffer: port static allocator to Lua
Date: Mon, 20 May 2019 12:06:34 +0300	[thread overview]
Message-ID: <20190520090634.GA3061@atlas> (raw)
In-Reply-To: <fa0cf0b3dfef88d1a70d717be015824c72ef9d29.1558217352.git.v.shpilevoy@tarantool.org>

* Vladislav Shpilevoy <v.shpilevoy@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

  reply	other threads:[~2019-05-20  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-18 22:15 [tarantool-patches] [PATCH v2 0/2] " Vladislav Shpilevoy
2019-05-18 22:15 ` [tarantool-patches] [PATCH v2 1/2] " Vladislav Shpilevoy
2019-05-20  9:06   ` Konstantin Osipov [this message]
2019-05-18 22:15 ` [tarantool-patches] [PATCH v2 2/2] buffer: replace all ffi.new(type[1]) with cached union Vladislav Shpilevoy
2019-05-20 14:59   ` [tarantool-patches] " Vladislav Shpilevoy
2019-05-20 15:26     ` Konstantin Osipov
2019-05-21 16:56 ` [tarantool-patches] Re: [PATCH v2 0/2] buffer: port static allocator to Lua Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190520090634.GA3061@atlas \
    --to=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v2 1/2] buffer: port static allocator to Lua' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox