From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0DA4C42F4AD for ; Sat, 20 Jun 2020 20:42:56 +0300 (MSK) References: <7b8e95f3d6da39f0c3c6ca742abccddda817ac5e.1592597647.git.imun@tarantool.org> From: Vladislav Shpilevoy Message-ID: <4150e5b8-b4c0-7151-d06e-a61d81eff97b@tarantool.org> Date: Sat, 20 Jun 2020 19:42:53 +0200 MIME-Version: 1.0 In-Reply-To: <7b8e95f3d6da39f0c3c6ca742abccddda817ac5e.1592597647.git.imun@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 2/2] box: reduce box_process_lua Lua GC memory usage List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Munkin , Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! On 19/06/2020 22:40, Igor Munkin wrote: > function created a new GCfunc object for a handler > having no upvalues depending on the request context on each call. > > The changes introduces the folliwing mapping: Either 'changes' -> 'change', or 'introduces' -> 'introduce'. 'folliwing' -> 'following'. > | -> > Initializing this mapping on Tarantool startup is aimed to reduce Lua GC > memory usage. > > Signed-off-by: Igor Munkin > --- > src/box/lua/call.c | 32 +++++++++++++++++++++++++++----- > 1 file changed, 27 insertions(+), 5 deletions(-) > > diff --git a/src/box/lua/call.c b/src/box/lua/call.c > index 6588ec2fa..e1b1a5e81 100644 > --- a/src/box/lua/call.c > +++ b/src/box/lua/call.c > @@ -48,6 +48,15 @@ > #include "mpstream/mpstream.h" > #include "box/session.h" > > +enum handlers { > + HANDLER_CALL, > + HANDLER_CALL_BY_REF, > + HANDLER_EVAL, > + HANDLER_MAX, Would be nice to have a comment here explaining why so complex. Why lua_pushcfunction() can't be used on each call. > +}; > + > +static int execute_lua_refs[HANDLER_MAX]; > + > /** > * A helper to find a Lua function by name and put it > * on top of the stack.