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 1tYpwU-00Fkgu-KB for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jan 2025 17:15:35 +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 1tYpwT-002bta-A2 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jan 2025 17:15:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tYpwT-002btO-0H for pgsql-hackers@lists.postgresql.org; Fri, 17 Jan 2025 17:15:33 +0000 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tYpwR-0003TV-1b for pgsql-hackers@postgresql.org; Fri, 17 Jan 2025 17:15:32 +0000 Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-844e9b8b0b9so177869739f.0 for ; Fri, 17 Jan 2025 09:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737134131; x=1737738931; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nBJgSE3d5Qh5x9pmBEcWmKwQOnZGjqzn4T/MT5yLRDw=; b=mI1bUYWYhvIjGtt2FutXlWNX8q8HpQritLMRmeRqZuEzAK7cZ9GOoO8/0MNCYTnaGX tz/Vyv3iLiZbvlomMYx+rYwJqqdiWw1zzpbXC1mSx0NA8XRE4/3fk4o6SqWqdPiUBfeZ 37d5Mz7PDR9QT83TRNbaV5RkbKFins/uC4eYzlxaWC9unhIMortzbi+T94GEBe3O7Vbd E47oDjoz39Bi8VkSbqMIjS8YrGCGjLgq6uAgEkHz87WA9BJwezUJCK5A6rsyKQzv517i vM6+rXe9xudRK59n+avHATXdnjkUO88EQXRIc4jtGI2dCijov28Huqv+BVq69jFGVXwK 64Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737134131; x=1737738931; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nBJgSE3d5Qh5x9pmBEcWmKwQOnZGjqzn4T/MT5yLRDw=; b=XNhtOaK6xWCEMegZfmeUALMBvZWnssTlsZ86wqwaKP1T+rJd8K9F0OtxrB1g7c1BF0 Q48GHWFRNIOjU0vypBLl+jYs73Ae76ak0nVRgrA17m9Lup4EYJ0eNeZ4qby8rCayPfwJ Ba7edRjlnTsQ3/3shCV9E9vsrxRnIxLbSMS0DaZQ5WxFaKCe289dWhDUmKWbjE61cVks xonjXSlwOHDGz+qAV3iCZM71Cgwb1VY9EkKHA/hkxl9WB9M9oVJmku7NAIwdI/CyGEUB lMW+UTo6EtBr4FuV1BIW9pD476KsPLwJ05Z0Vh85hvF2GPHGKpHW+snVorMJnoElkCc1 QYXA== X-Forwarded-Encrypted: i=1; AJvYcCVKrKo19WBP5uiWoijCH4xZoRj8mZ0Ofavm3PimdtleLlseMiCVaIOeWUQsZBjh00MjXh7B64ugAJRS9vdg@postgresql.org X-Gm-Message-State: AOJu0YwglAK1z1dhGQAX7gc1DSY+w7KPVzhVJCfE4mc5cC/KkQ8sNR0J arRNjd6diSFjmCugH1zkhWPmKF1L+m/4q367ZUQ7zcJydAbBOTeD X-Gm-Gg: ASbGncuql3aFoShyMNybyCllt06l4U7vrUFanLk9/JFQWd9bhfi4y/7EhK9hX1+Hejp XEJ0x2bi680N0GSy1dXwPDDKC0KagYqgOhgM3urL0hjByq8FfVSh2X3Lf1B2cp3iJ8YsVsw6zGC XC0NG0QssktkHfNvStUkeqW33J1bwwcIkTZt5yHb48SOEUo0TBltH48m5h1qgI/tV5rhkFmh38s yZtA4oez1XRaw1ybWnI9qb815hKfsYJ9t66oddzhnBSO7+HTCTGjhZ5rTsDh6GCPtzbhy/pr9u0 TrCM/rf7w0IMlqfeBu9px3ITARnmMj1MZ9PxS3m3R1EUrUE= X-Google-Smtp-Source: AGHT+IEX/pEbSUGjPSxvqzucF2h0WCthNAu+V0ADbIqcX+irqh+Z2DZzM6aVhKAdjWL5lus+poXYHA== X-Received: by 2002:a05:6602:6b07:b0:843:f220:fa3d with SMTP id ca18e2360f4ac-851b624142emr287160339f.7.1737134131214; Fri, 17 Jan 2025 09:15:31 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ea75496631sm723225173.70.2025.01.17.09.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 09:15:30 -0800 (PST) Date: Fri, 17 Jan 2025 11:15:29 -0600 From: Nathan Bossart To: Tom Lane Cc: David Rowley , John Naylor , "Chiranmoy.Bhattacharya@fujitsu.com" , "Devanga.Susmitha@fujitsu.com" , "pgsql-hackers@postgresql.org" , "Ragesh.Hajela@fujitsu.com" Subject: Re: [PATCH] Hex-coding optimizations using SVE on ARM. Message-ID: References: <622082.1736834344@sss.pgh.pa.us> <1194263.1736925288@sss.pgh.pa.us> <1519827.1736990839@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519827.1736990839@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk With commit e24d770 in place, I took a closer look at hex_decode(), and I concluded that doing anything better without intrinsics would likely require either a huge lookup table or something with complexity rivalling the instrinsics approach (while also not rivalling its performance). So, I took a closer look at the instrinsics patches and had the following thoughts: * The approach looks generally reasonable to me, but IMHO the code needs much more commentary to explain how it works. * The functions that test the length before potentially calling a function pointer should probably be inlined (see pg_popcount() in pg_bitutils.h). I wouldn't be surprised if some compilers are inlining this stuff already, but it's probably worth being explicit about it. * Finally, I think we should ensure we've established a really strong case for this optimization. IME these intrinsics patches require a ton of time and energy, and the code is often extremely complex. I would be interested to see how your bytea test compares with the improvements added in commit e24d770 and with sending the data in binary. -- nathan