Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guk1B-0007oY-Ir for pgsql-committers@arkaria.postgresql.org; Fri, 15 Feb 2019 20:23:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guk1A-0000va-0Y for pgsql-committers@arkaria.postgresql.org; Fri, 15 Feb 2019 20:23:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guk19-0000vT-R4 for pgsql-committers@lists.postgresql.org; Fri, 15 Feb 2019 20:23:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guk13-0004iO-EE for pgsql-committers@lists.postgresql.org; Fri, 15 Feb 2019 20:23:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1FKNH3k021580; Fri, 15 Feb 2019 15:23:17 -0500 From: Tom Lane To: Alvaro Herrera cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix compiler builtin usage in new pg_bitutils.c In-reply-to: <20190215201804.GA791@alvherre.pgsql> References: <20190215201804.GA791@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 15 Feb 2019 17:18:05 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21578.1550262197.1@sss.pgh.pa.us> Date: Fri, 15 Feb 2019 15:23:17 -0500 Message-ID: <21579.1550262197@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2019-Feb-15, Tom Lane wrote: >> Sure, I'll pick it up. I agree it's probably a marginal performance >> change, but it seems a shame to give up when we were 80% of the way >> there. > (BTW, my reading of the articles I cited, as well as my own runs of the > test programs therein, suggest that in order to get a really good > performance improvement you need to hand-code calls to the POPCNT > instruction in assembly rather than rely on the compiler intrinsics. I > think there is^Wwas almost enough infrastructure to do that. I'm not > sure that the operations being optimized by these changes are > interesting enough, in the grand scheme of things.) Yeah, that last point is a fair one; if the situation were static, I'm not sure it'd be worth the trouble either. But I think that once we have these functions we may find more uses for them. IIRC, there's already one patch in the CF queue that wanted to use __builtin_clz for something or other. regards, tom lane