Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odR7V-0001Bn-Gr for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Sep 2022 07:04:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1odR7T-0008N2-Se for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Sep 2022 07:04:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odR7T-0008Jq-Fj for pgsql-hackers@lists.postgresql.org; Wed, 28 Sep 2022 07:04:35 +0000 Received: from mx.zeyos.com ([88.99.153.70]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odR7Q-00063o-W8 for pgsql-hackers@postgresql.org; Wed, 28 Sep 2022 07:04:35 +0000 Received: from mx.zeyos.com (localhost [127.0.0.1]) by mx.zeyos.com (Postfix) with ESMTP id 8B475619DB for ; Wed, 28 Sep 2022 09:04:31 +0200 (CEST) Authentication-Results: mx.zeyos.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=zeyos.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zeyos.com; h= content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:to:from:from:subject:subject :date:date; s=dkim; t=1664348671; x=1665212672; bh=4E2J4Ja2sxTVl OBSezdQ61TQtRTRy3rZr89iD9HdCG8=; b=gSmW31K0fwECNqnu3TsPdZq2Z4p8+ Wf7iqVtB2jqPlHG/P1Br2puMVT1hs87JD9SeN+J9KhUJ4X5w5bNdNIwq4zEbFb8j mu1zcJ8GubEyLq1vihOpiCoggjuWEPxla0PDqw6v9zEgH8Dlsts3Ik37HLOkjJdY eHqQMCo2mE8fgA= X-Virus-Scanned: Debian amavisd-new at mx.zeyos.com Received: from mx.zeyos.com ([127.0.0.1]) by mx.zeyos.com (mx.zeyos.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dOLP3AvWW0vk for ; Wed, 28 Sep 2022 09:04:31 +0200 (CEST) Received: from cloud.zeyos.com (static.182.82.88.23.clients.your-server.de [23.88.82.182]) by mx.zeyos.com (Postfix) with ESMTPSA id 29168619BB; Wed, 28 Sep 2022 09:04:31 +0200 (CEST) Date: Wed, 28 Sep 2022 09:04:31 +0200 Subject: Re: Insertion Sort Improvements From: Benjamin Coutu To: John Naylor Cc: pgsql-hackers Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > "Looks like"?=0A=0AI cannot find the reference, but I've read a while bac= k that a well-known company from Redwood uses it for their in-memory column= ar storage. That might have just been a rumor or might have been research o= nly - not sure. It does not really matter anyways.=0A=0A> SortTuples are cu= rrently 24 bytes, and supported vector registers are 16 bytes, so not sure = how you think that would work.=0A=0AThe thought was to logically group mult= iple sort tuples together and then create a vectorized version of that grou= p with just the primitive type sort key as well as a small-sized index/offs= et into that sort group to later swap the corresponding sort tuple referenc= ed by that index/offset. The sorting network would allow us to do branch-le= ss register based sorting for a particular sort run. I guess this idea is m= oot, given ...=0A=0A> More broadly, the more invasive a change=C2=A0is, the= more risk is involved,=C2=A0and the more effort to test and evaluate. If y= ou're serious about trying to improve insertion sort performance, the simpl= e idea we discussed at the start of the thread is a much=C2=A0more modest s= tep that=C2=A0has a good chance of justifying the time put into it. That is= not to say it's easy, however, because testing is a non-trivial amount of = work.=0A=0AI absolutely agree. Let's concentrate on improving things increm= entally.=0APlease excuse me wondering given that you have contributed some = of the recent vectorization stuff and seeing that you have obviously experi= mented a lot with the sort code, that you might already have tried somethin= g along those lines or researched the subject - it is definitely a very int= eresting topic.=0A=0ACheers, Ben