From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 06BFF27B1B for ; Thu, 21 Feb 2019 06:11:35 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hK7GujE4YoSD for ; Thu, 21 Feb 2019 06:11:34 -0500 (EST) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id BB0EA21BA5 for ; Thu, 21 Feb 2019 06:11:34 -0500 (EST) Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1gwmGL-0003Ne-AI for tarantool-patches@freelists.org; Thu, 21 Feb 2019 14:11:33 +0300 Date: Thu, 21 Feb 2019 14:11:33 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 08/12] vinyl: remove optimized comparators Message-ID: <20190221111133.GH3872@chai> References: <52cf8dd45c4ebd27368bef7311c71ef665931f53.1550744027.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52cf8dd45c4ebd27368bef7311c71ef665931f53.1550744027.git.vdavydov.dev@gmail.com> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org * Vladimir Davydov [19/02/21 13:31]: > 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 a 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 is required > to support multikey index, 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. This is OK to push, but please don't push it until it's really needed (e.g. until you get OK to push on a patch which uses it). -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov