From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 13 Mar 2019 11:55:00 +0300 From: Konstantin Osipov Subject: Re: [PATCH v2 01/14] vinyl: remove optimized comparators Message-ID: <20190313085500.GA25066@chai> References: <02d92cc9c297e06669a1ec41a876e4b9022ec28f.1552464666.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02d92cc9c297e06669a1ec41a876e4b9022ec28f.1552464666.git.vdavydov.dev@gmail.com> To: Vladimir Davydov Cc: tarantool-patches@freelists.org List-ID: * Vladimir Davydov [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