From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] Re: box: disable sparse optimization in box.tuple.new() Date: Tue, 12 Feb 2019 18:50:06 +0100 [thread overview] Message-ID: <57b38a8d-14f4-a272-7fdb-4f6cf08cf925@tarantool.org> (raw) In-Reply-To: <708eb7bb-88a5-7663-3682-bd4d4a61d2c5@tarantool.org> Hi! Thanks for the patch! On 12/02/2019 14:18, Kirill Shcherbatov wrote: > The box.tuple.new() used to call luamp_encode_tuple with > default LUA serializer config 'luaL_msgpack_default'. This > routine may consider an array to be excessively sparse when > + encode_sparse_ratio > 0 > + max(table) > encode_sparse_safe > + max(table) > count(table) * encode_sparse_ratio. > Sparse optimization save memory via representing excessively > sparse tuple as MP_MAP. But Tarantool tuple always must be > MP_ARRAY so it is not relevant for box.tuple.new semantics. > So it is disabled with encode_sparse_ratio = 0 in a new local > serializer config. > > Closes #3882 > --- Please, next time put here links to the branch and issue. The patch is ok for me. But I see, that Kostja complaints, that you could create a special serializer for it. I agree, but I see a drawback about it. Separate serializer would be unconfigurable. Now a user can change serializer by making require('msgpack').cfg(...). So the issue can be fixed manually like this even on 2.1: [002] Test failed! Result content mismatch: [002] --- box/tuple.result Tue Feb 12 18:26:58 2019 [002] +++ box/tuple.reject Tue Feb 12 18:42:10 2019 [002] @@ -1168,6 +1168,12 @@ [002] -- gh-3882: Inappropriate storage optimization for sparse arrays [002] -- in box.tuple.new. [002] -- [002] +m = require('msgpack') [002] +--- [002] +... [002] +m.cfg{encode_sparse_ratio = 0} [002] +--- [002] +... I added these two lines without a patch, and the test passed. With Kostja's way of implementation, tuple encoding would be impossible to configure. If Kostja thinks, that your way does not work, then do whatever he wants, please. Ask him for clarification. > src/box/lua/tuple.c | 9 ++++++++ > test/box/tuple.result | 50 +++++++++++++++++++++++++++++++++++++++++ > test/box/tuple.test.lua | 26 +++++++++++++++++++++ > 3 files changed, 85 insertions(+) >
next prev parent reply other threads:[~2019-02-12 17:50 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-11 10:43 [tarantool-patches] [PATCH v1 1/1] " Kirill Shcherbatov 2019-02-12 11:18 ` [tarantool-patches] " Kirill Shcherbatov 2019-02-12 11:33 ` [tarantool-patches] " Konstantin Osipov 2019-02-12 17:50 ` Vladislav Shpilevoy [this message] 2019-02-13 12:19 ` Konstantin Osipov 2019-02-15 15:17 ` Kirill Shcherbatov 2019-02-15 21:31 ` Vladislav Shpilevoy 2019-02-18 8:45 ` [tarantool-patches] Re: [PATCH v1 1/1] " Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=57b38a8d-14f4-a272-7fdb-4f6cf08cf925@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: box: disable sparse optimization in box.tuple.new()' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox