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 1oasTI-0002Ow-SD for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Sep 2022 05:40:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oasTH-0008K4-PM for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Sep 2022 05:40:31 +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 1oasTG-0008Ju-Bf for pgsql-hackers@lists.postgresql.org; Wed, 21 Sep 2022 05:40:31 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oasTA-0000k4-Hf for pgsql-hackers@postgresql.org; Wed, 21 Sep 2022 05:40:29 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id A492A3200A03; Wed, 21 Sep 2022 01:40:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 21 Sep 2022 01:40:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1663738820; x=1663825220; bh=W2Uaz25tw1 sfc2T0oWWtmYPveUWhrqyTOVy4fobxiMI=; b=gE3ZeLiHZlcl1OneOTQsHQmTe+ wZAgOt06JRhQp0HHkSDW0YkgD5NrlV/bvbmiDR2l8zm+PWOenj1sAzgaZyuABAt5 DrTEGH9fKs7/b+hj8BskkMPYnjGVRKuQhiRHo5S9e1JJDK2hmhDw6En6PHRN9stj czY5Zb7l1iWAJ/khRndeEOAy7UTGmTFrLNI+LAGbM4ZoFiMBlryM+lD5F6kzcgv/ 2pJiQw5b6kUrCwo9Vm+UGoNR/nRkxQwHz+ZIcA0hPcBmtghCI932IozFniHKn3mI aGOI4XOakKnR38hGF1zW86eqI0WKCF9EuHfpMOOvjXhNforezMji1AsjPoKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1663738820; x=1663825220; bh=W2Uaz25tw1sfc2T0oWWtmYPveUWh rqyTOVy4fobxiMI=; b=wt1HaeLwM/X5vKAgd4lPnOFszjFTchoy2ljNumUz391a 5U7u8o5Yf+eVogqgaSfpQUDC3DmlxdNx5Ozn9V1l3XATji3YbPKkRDIAyEUWj1q1 HVQwpzr8qbKPif+v1nNp8oaeYoKmXvr/746BJX2d3O261KO0FnmlGdAKyqx2OhID jJF/lrBBQdQmnaJNMO3krKeq6IPqb20r8nGpFtFk9LLvs9oYvS39A51VrXKH9Wzy zBOQRNZZOfz4YtxsTJJa5VQ1EHhkAIv1gm/2NTpeXFMLo2oD5Xk6bGW6PnNk6Lwc +zH0toRPoA1v2VaKfo7GLpqyqxm3hfevql3pIWDxdg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeftddguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreer tddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlse hprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteel geeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdig hiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Sep 2022 01:40:18 -0400 (EDT) Date: Wed, 21 Sep 2022 14:40:13 +0900 From: Michael Paquier To: Nathan Bossart Cc: Richard Guo , PostgreSQL-development Subject: Re: make additional use of optimized linear search routines Message-ID: References: <20220901185153.GA783106@nathanxps13> <20220902221611.GC1261322@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7Kp+ZadZUM+x/etc" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --7Kp+ZadZUM+x/etc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 03, 2022 at 10:06:58AM +0900, Michael Paquier wrote: > Ohoh. This sounds like a good idea to me, close to what John has > applied lately. I'll take a closer look.. So, the two code paths patched here are rather isolated. The one in TransactionIdIsInProgress() requires an overflowed set of subxids still running, something similar to what the isolation test subxid-overflow does. XidIsConcurrent() is also kind of hard to reason about with a benchmark. Anyway, I did not know about the work done with SIMD instructions in pg_lfind.h and after playing the API I have run some micro benchmarks with on pg_lfind32() and I can see some improvements. With a range of 100~10k elements in a fixed number of repeated calls with a for loop and lfind(), I could not get up to the 40% speedup. That was somewhat closer to 15%~20% on x86 and 20%~25% with arm64. There is a trend=20 where things got better with a higher number of elements with lfind(). In short, switching those code paths to use the linear search routines looks like a good thing in the long-term, so I would like to apply this patch. If you have any comments or objections, please feel free. -- Michael --7Kp+ZadZUM+x/etc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmMqo70ACgkQnvQgOdby QH3IQBAAnCWj9FCLXIvC4pZqos3F+Ip8mXsVxiD/WKbMCfhH8DhvCj5YpZ2phQIo 7Se8TpiN3NPaaVhUXjj13KDg+w52jWC6Lg6F2a5Z2dZR6yKn5f8uON8LilKLzKub COJXsTE2jJIUzuVhzLR0EJDvdmsJjJWYzxwCJ6EHaCmnECYKLyeRbkJfKgzGj4f9 2Ybvj+OK0G6hubuJ5dws7EG1jedgbk+zjVhAVfJyGt9vxxaBy8p0Nfam+H8E7AHs CS1qHpdVVbetyAT+cODFyOGdm4vbLfwcNOXwCRgDt1opXzzr7pl0rfVbHwfInhVU GsaZW85nHjJwRQVYzLgPSUfeEOLYcOQzee8VxwvytfghJyKLGh0uz1lMXSfGCY6D LxwEMfH1WG95Nf3hmHtWiN2JO6Kjykwsu7KSH9bHeOa+Wf+xMob9LriKK4wk7srw sHQaxRcXwGWi3AOmCkKWKfsqYqobLbd0qrtBcu/rPk00LJ3OIYgDjenjzvOwECCj xzJ4L2CtyyrA69Q2lU656S/ExOH4oIRZD1fns1DQ63/J3N/284xfXRGH7Fx5t9PP NwFIC/0AtBfb3iIEuMCNuUCi/lRtOBlJz4Bb7IS7lXQK/SOCgguNMQAF6qyjorhv xch80PR5xQbOThAY/iVhI2ChwWlpyMxH6H/7V015aCTKGHxc5nc= =kX6v -----END PGP SIGNATURE----- --7Kp+ZadZUM+x/etc--