[PATCH v2 01/14] vinyl: remove optimized comparators

Konstantin Osipov kostja at tarantool.org
Wed Mar 13 11:55:00 MSK 2019


* Vladimir Davydov <vdavydov.dev at gmail.com> [19/03/13 11:53]:
> A vinyl statement (vy_stmt struct) may represent either a tuple or a
> key. We differentiate between the two kinds by statement type - we use
> SELECT for keys and other types for tuples. This was done that way so
> that we could pass both tuples and keys to a read iterator as a search
> key. To avoid branching in comparators when the types of compared
> statements are known in advance, we provide several comparators, each of
> which expects certain statement types, e.g. a tuple and a key. Actually,
> such a micro optimization looks like an overkill, because a typical
> comparator is called by function pointer and has a lot of comparisons
> in the code, see tuple_compare_slowpath for instance. Eliminating one
> branch will hardly make the code perform better. At the same time, it
> makes the code more difficult to write. Besides, once we remove nils
> from statements read from disk (aka surrogate tuples), which will
> ease implementation of multikey indexes, the number of places where
> types of compared statements are known will diminish drastically.
> That said, let's remove optimized comparators and always use
> vy_stmt_compare, which checks types of compared statements and calls
> the appropriate comparator.

OK to push.


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list