Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsOrm-001XxD-Ff for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Mar 2025 16:23:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tsOrl-008WhD-4K for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Mar 2025 16:23:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsOrk-008Wh2-NQ for pgsql-hackers@lists.postgresql.org; Wed, 12 Mar 2025 16:23:32 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tsOrg-002Tuy-3A for pgsql-hackers@postgresql.org; Wed, 12 Mar 2025 16:23:32 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 28D1B11401DD; Wed, 12 Mar 2025 12:23:29 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 12 Mar 2025 12:23:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1741796609; x=1741883009; bh=g 1ucgAXZqPvXp3TCl7P9qAY71pKxJArXkve/Q02WT0k=; b=RyFi/trLyaS/YHFtj h2Q6imZBtSjMFVDb5YZy+Sb/iRVvEgaW+sPWDjEAZeppAPOncPctc5mBjiw2b1oi w6g5Re211m4Hv6n9K0w9iSgVUAfDmmnqxHzjC0KPSbuC1xXbJdL0XX1AMUbQb6B3 GAarA/vIy/pd25ETgvONgt+IW5oQ055VSh9duSBU27yPXBCvZ1Z2ZxOYkpJLe/5u FFzM1/o1mwaQ1W8XGBQFFM7JF4DuZRN9C5/ORlvdwcFkUbw1A4LTqURrHw5o4KwS kVCRwHOEDBc6y83PF5ZQfq6P0krsdq14PiNCjInvJfeUR1GBwDa4mb/i206TwBOU Zk39w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdehheegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddt jeenucfhrhhomheplmhlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlh hvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdfhtefghfdvfeefieeu feevgefhveehueeftdehgfefheduffetffehffdujeeunecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghdpvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlh hvhhdrnhhoqdhiphdrohhrghdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepnhgrthhhrghnuggsohhsshgrrhhtsehgmhgrihhlrdgtohhmpd hrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Mar 2025 12:23:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1741796605; bh=DlqgHwh1f/62qhXmpIF1qEDp54w2y95IDHZgz2dMURc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=qCSqGjL0g085ALQN66hAoCOETgOwNCrmDgVdRgMqkDHt3LH2j2dfXsB8ItxEjSGir SEtLqtbGXvazPx7Y4ZZzPJ4up7t5FpYiuB1Wo0v8tCz8HR4fmfxk424/d7SfJLUUrE 3k9soRZatkUWYx0j20LBb7v445+N6GN7WSa2Lp70fcY0e08febnCpMhlXvGTqq6aj4 LwFTbjchXnXhkw9pi9s9vG2lrTrrtWrkIUuCi3hJbuBdlsg4+sv09cgAU7UWHSlAj8 HnaQvljAUl9tZfYf/n0JtBavN9Cb/t3D7bn4rfcU1ZAf/H6Z0n9XBIc9Vnb3wUOw9n 5x5+1HwFLCklA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 4CBC691; Wed, 12 Mar 2025 17:23:25 +0100 (CET) Date: Wed, 12 Mar 2025 17:23:25 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Nathan Bossart Cc: pgsql-hackers@postgresql.org Subject: Re: remove open-coded popcount in acl.c Message-ID: <202503121623.i4enp6airsfl@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Mar-12, Nathan Bossart wrote: > There's a count_one_bits() function in acl.c that can be replaced with a > call to pg_popcount64(). This isn't performance-critical code, but IMHO we > might as well use the centralized implementation. Makes sense. Patch looks good to me. > @@ -5532,7 +5514,7 @@ select_best_grantor(Oid roleId, AclMode privileges, > */ > if (otherprivs != ACL_NO_RIGHTS) > { > - int nnewrights = count_one_bits(otherprivs); > + int nnewrights = pg_popcount64(otherprivs); Strange: this code is not covered by any tests. https://coverage.postgresql.org/src/backend/utils/adt/acl.c.gcov.html#5533 https://coverage.postgresql.org/src/backend/utils/adt/acl.c.gcov.html#5438 -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/