[Tarantool-patches] [PATCH 2/2] box: reduce box_process_lua Lua GC memory usage

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Jun 20 20:42:53 MSK 2020


Hi! Thanks for the patch!

On 19/06/2020 22:40, Igor Munkin wrote:
> <box_process_lua> 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'.

> | <handler id> -> <handler GCfunc object>
> Initializing this mapping on Tarantool startup is aimed to reduce Lua GC
> memory usage.
> 
> Signed-off-by: Igor Munkin <imun at tarantool.org>
> ---
>  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.


More information about the Tarantool-patches mailing list