[tarantool-patches] Re: [PATCH v1 4/8] box: load persistent Lua functions on creation

Kirill Shcherbatov kshcherbatov at tarantool.org
Mon Jun 3 11:26:29 MSK 2019


On 31.05.2019 11:16, Konstantin Osipov wrote:
> * Kirill Shcherbatov <kshcherbatov at tarantool.org> [19/05/30 14:12]:
> 
> Could you please benchmark how much slower is a function
> invocation in a fresh sandbox compared to a re-cycled one? 
> 
> How many invocations per second can we get for a simple ffunction
> like return a*a?

Hi! I don't quite understand what you asked me to do.
I measured performance in the following scenarios:

Case 1. Function load
lua_code = [[function(tuple) return tuple[1]*tuple[2] end]]
box.schema.func.create('extract', {body = lua_code, is_deterministic = true, returns = 'integer'})
1) function creation doesn't assemble a new sandbox, but makes a deepcopy of existent one (as on branch)
   50830 FUNCTION LOADS/SEC
2) function creation assembles a new sandbox (with luaT_prepare_sandbox) and applies it (lua_setfenv)
   49817 FUNCTION LOADS/SEC
3) function creation use an existent sandbox and doesn't make it's deepcopy (no monkey-patch protection
    between the extractors)
   204188 FUNCTION LOADS/SEC


Case 2. (part of the last patch) Function call
"return 1": 914445 CALLS/SEC
"return tuple[1] + tuple[2]": 882009 CALLS/SEC
"sharonovAddrExtractor": 164499 CALLS/SEC



More information about the Tarantool-patches mailing list