From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 12 Mar 2019 16:00:05 +0300 From: Vladimir Davydov Subject: Re: [PATCH v5 2/4] memtx: introduce tuple compare hint Message-ID: <20190312130005.wotntpiyq53yowm7@esperanza> References: <53e165cf566611452821c692d79d621628e839ff.1551951540.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53e165cf566611452821c692d79d621628e839ff.1551951540.git.kshcherbatov@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: On Thu, Mar 07, 2019 at 12:44:06PM +0300, Kirill Shcherbatov wrote: > +/* {{{ tuple_aux_compare_with_key */ > + > +static int > +tuple_hinted_compare_with_key(const struct tuple *tuple, cmp_aux_t tuple_cmp_aux, > + const char *key, uint32_t part_count, > + cmp_aux_t key_cmp_aux, struct key_def *key_def) > +{ > + uint64_t tuple_hint = tuple_cmp_aux.hint; > + uint64_t key_hint = key_cmp_aux.hint; > + if (likely(tuple_hint != key_hint && tuple_hint != CMP_HINT_INVALID && > + key_hint != CMP_HINT_INVALID)) > + return tuple_hint < key_hint ? -1 : 1; > + else > + return tuple_compare_with_key(tuple, key, part_count, key_def); This will lead to double indirection - first you call key_def->tuple_hinted_compare_with_key, which in turn calls key_def->tuple_compare_with_key. This will introduce some performance penalty, I guess. Avoid that, please.