From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 10 Jun 2019 17:41:44 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH v2 7/9] box: sandbox option for persistent functions Message-ID: <20190610144144.3oxxjerkz3mqvvra@esperanza> References: <6b79e42320697259d90dfbc4ed0ff79882a857ee.1559822429.git.kshcherbatov@tarantool.org> <20190610140645.orrfcqklmum7nhsd@esperanza> <45e93824-0c46-db7c-13af-134dacef9b23@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45e93824-0c46-db7c-13af-134dacef9b23@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: On Mon, Jun 10, 2019 at 05:15:14PM +0300, Kirill Shcherbatov wrote: > >> +{ > >> + if (luaL_deepcopy_func_ref == LUA_REFNIL) { > >> + int count; > >> + const char *deepcopy = "table.deepcopy"; > >> + if (luaT_func_find(L, deepcopy, deepcopy + strlen(deepcopy), > >> + &count) != 0) > >> + return -1; > > > > Wouldn't it be more effecient to copy the table in C, i.e. without the > > aid of 'table.deepcopy' method? > > What do you mean? I mean rather than calling table.deepcopy function written in Lua, wouldn't it be more effecient to do deepcopy in C using Lua C API? Well, never mind. I guess we don't need to optimize this case, as we only create a sandbox on function creation, not invocation.