Skip to content
Snippets Groups Projects
Commit 604b98ee authored by Igor Munkin's avatar Igor Munkin Committed by Kirill Yukhin
Browse files

lua/utils: improve luaT_newthread performance


<luaT_newthread> created a new GCfunc object for the helper invoked in a
protected <lua_cpcall> frame (i.e. <luaT_newthread_wrapper>) on each
call. The change introduces a static reference to a GCfunc object for
<luaT_newthread_wrapper> to be initialized on Tarantool startup to
reduce Lua GC memory usage.

Furthermore, since <lua_cpcall> yields nothing on guest stack, the newly
created Lua coroutine need to be pushed back to prevent its sweep. So
to reduce guest stack manipulations <lua_cpcall> is replaced with
<lua_pcall> and the resulting Lua thread is obtained via guest stack.

Part of #5201

Reviewed-by: default avatarSergey Ostanevich <sergos@tarantool.org>
Reviewed-by: default avatarVladislav Shpilevoy <v.shpilevoy@tarantool.org>
Signed-off-by: default avatarIgor Munkin <imun@tarantool.org>
parent cd292adb
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment