[PATCH v5 2/4] memtx: introduce tuple compare hint
Vladimir Davydov
vdavydov.dev at gmail.com
Tue Mar 12 16:00:05 MSK 2019
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.
More information about the Tarantool-patches
mailing list