From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Alexander Turenko <alexander.turenko@tarantool.org> Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>, tarantool-patches@freelists.org Subject: Re: [tarantool-patches] Re: [PATCH v2 2/2] lua: add key_def lua module Date: Thu, 4 Apr 2019 17:36:56 +0300 [thread overview] Message-ID: <20190404143655.ymzuaihqcxzjjf3j@esperanza> (raw) In-Reply-To: <20190404114622.cunxe3zhnaux5gd7@tkn_work_nb> On Thu, Apr 04, 2019 at 02:46:22PM +0300, Alexander Turenko wrote: > > > >> Probably, we should reuse tuple_validate() for checking a tuple against > > > >> a key_def so as not to implement the same code again. > > > > > > Unfortunately tuple_validate() is designed for format validation while we don't > > > have format here and I don't like create it for validation event in case of error. > > > > Creating a format on each call to 'compare' is prohibitive from > > performance pov, you're right. However, we could attach a format to > > Lua's key_def object. This would also speed up comparisons, as tuples > > So this module will not more be relatively simple layer that exposes > box/key_def into Lua and this again suggests me that the name key_def > maybe is not good choice. > > > created for this format would have fieldmap. > > Note: It will speed up comparisons only in case when a user give a lua Yeah, right. So speeding up comparisons isn't an iron-clad argument for attaching a format to Lua key_def object. May be not worth the complexity it will introduce. > table as input, not when it give a tuple. However if a user give a tuple > it seems that it is in (s)he responsibility to think about the format. > > And, while we're here, maybe it worth to provide a function like > box.tuple.new(), but with key_def instance as an argument to allow a > user to create tuples with necessary formats (to speed up comparisons > and other fields accesses)? No, I don't think so: the API wouldn't be generic enough, because one might want to compare the same tuple using different key definitions. > > > However, what I don't like is that in case a tuple is created from a Lua > > table, you'll have to access all fields twice - on validation and > > comparison - which is costly without a fieldmap. One more argument for > > attaching a format to Lua's key_def object. > > I think we can add *_unchecked() function variants like in > msgpack/msgpackffi if the peformance will be really a problem and > someone will request for them. I don't think that _unchecked (i.e. crash on malformed input) is a good idea, especially in this case.
next prev parent reply other threads:[~2019-04-04 14:36 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-27 14:29 [tarantool-patches] [PATCH v2 0/2] " Kirill Shcherbatov 2019-03-27 14:29 ` [tarantool-patches] [PATCH v2 1/2] lua: add luaT_tuple_new() Kirill Shcherbatov 2019-03-28 9:01 ` [tarantool-patches] " Konstantin Osipov 2019-03-28 9:18 ` Alexander Turenko 2019-04-03 18:01 ` [tarantool-patches] " Vladimir Davydov 2019-04-04 2:51 ` Alexander Turenko 2019-04-04 8:14 ` Vladimir Davydov 2019-03-27 14:29 ` [tarantool-patches] [PATCH v2 2/2] lua: add key_def lua module Kirill Shcherbatov 2019-03-28 2:01 ` Alexander Turenko 2019-03-28 7:38 ` [tarantool-patches] " Kirill Shcherbatov 2019-03-28 8:41 ` Kirill Shcherbatov [not found] ` <6d915212-e80f-4a6d-d884-b838bf25f8a7@tarantool.org> 2019-03-28 11:22 ` Alexander Turenko 2019-04-03 11:10 ` Vladimir Davydov 2019-04-03 11:46 ` Alexander Turenko 2019-04-03 12:01 ` Vladimir Davydov 2019-04-03 13:26 ` Alexander Turenko 2019-04-04 5:07 ` Alexander Turenko 2019-04-04 8:04 ` Kirill Shcherbatov 2019-04-04 9:05 ` Vladimir Davydov 2019-04-04 11:46 ` Alexander Turenko 2019-04-04 14:36 ` Vladimir Davydov [this message] 2019-04-04 8:38 ` Vladimir Davydov 2019-04-04 11:17 ` Alexander Turenko 2019-04-04 12:00 ` Alexander Turenko 2019-04-04 14:42 ` Vladimir Davydov
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=20190404143655.ymzuaihqcxzjjf3j@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=alexander.turenko@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] Re: [PATCH v2 2/2] lua: add key_def lua module' \ /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