public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: [email protected] <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: John Naylor <[email protected]>
Cc: David Rowley <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [PATCH] Hex-coding optimizations using SVE on ARM.
Date: Tue, 23 Sep 2025 14:02:54 -0500
Message-ID: <aNLu3mg3CV8VHZuv@nathan> (raw)
In-Reply-To: <aNGsGMowsTwd5_aY@nathan>
References: <TY4PR01MB15177710A7DF163A8536F26289701A@TY4PR01MB15177.jpnprd01.prod.outlook.com>
	<CANWCAZZm4zwAFmy6M32Sj2BfDg8ZjEV4TJ0YwBQewjV=AUY1Qw@mail.gmail.com>
	<OS9PR01MB15185B278E343A9BA5F0F6AB19700A@OS9PR01MB15185.jpnprd01.prod.outlook.com>
	<aMI-NF6KLc1x1pko@nathan>
	<OS9PR01MB1518513BA12A54A243342A2999709A@OS9PR01MB15185.jpnprd01.prod.outlook.com>
	<aMLpq9_wOz_tnHmm@nathan>
	<[email protected]>
	<OS9PR01MB1518531C5857F194371EBCA329708A@OS9PR01MB15185.jpnprd01.prod.outlook.com>
	<aMSQ7ackQO-P7T3S@nathan>
	<aNGsGMowsTwd5_aY@nathan>

On Mon, Sep 22, 2025 at 03:05:44PM -0500, Nathan Bossart wrote:
> I was able to improve the hex_decode() implementation a bit.

I took a closer look at how hex_decode() performs with smaller inputs.
There are some small regressions, so I tried fixing them by adding the
following to the beginning of the function:

    if (likely(tail_idx == 0))
        return hex_decode_safe_scalar(src, len, dst, escontext);

This helped a little, but it mostly just slowed things down for larger
inputs on AArch64:

                arm
    buf  | HEAD  | patch |  fix 
  -------+-------+-------+-------
       2 |     4 |     6 |     4
       4 |     6 |     7 |     7
       8 |     8 |     8 |     8
      16 |    11 |    12 |    11
      32 |    18 |     5 |     6
      64 |    38 |     7 |     8
     256 |   134 |    18 |    24
    1024 |   514 |    67 |   100
    4096 |  2072 |   280 |   389
   16384 |  8409 |  1126 |  1537
   65536 | 34704 |  4498 |  6128

                x86
    buf  | HEAD  | patch |  fix
  -------+-------+-------+-------
       2 |     2 |     2 |     2
       4 |     3 |     3 |     3
       8 |     4 |     4 |     4
      16 |     8 |     9 |     8
      32 |    23 |     5 |     5
      64 |    37 |     7 |     7
     256 |   122 |    24 |    24
    1024 |   457 |    91 |    92
    4096 |  1798 |   357 |   358
   16384 |  7161 |  1411 |  1416
   65536 | 28621 |  5630 |  5653

I didn't do this test for hex_encode(), but I'd expect it to follow a
similar pattern.  I'm tempted to suggest that these regressions are within
tolerable levels and to forge on with v10.  In any case, IMHO this patch is
approaching committable quality, so I'd be grateful for any feedback.

-- 
nathan





view thread (36+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Hex-coding optimizations using SVE on ARM.
  In-Reply-To: <aNLu3mg3CV8VHZuv@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox