Re: Optimize UUID parse using SIMD

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Haibo Yan <tristan(dot)yim(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimize UUID parse using SIMD
Date: 2026-08-18 20:13:36
Message-ID: CAD21AoD0nDmPqPd8mi8KK173R9Mcg2oTj7W6THM4bLRrvJ+HDw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 18, 2026 at 1:53 AM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
>
> On Tue, Aug 18, 2026 at 5:21 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > I've updated the patch accordingly. Please review it.
>
> + * Note that this fast path is not conditional on SIMD support:
> + * hex_decode_safe() picks a vectorized or scalar implementation itself, and
> + * even its scalar implementation is far faster than string_to_uuid_scalar().
>
> This doesn't seem like relevant info at the interface level -- I'd
> just leave it out. The previous paragraph already states that it calls
> out to hex_decode_safe() when possible. It's also confusing to later
> read:
>
> + * Decode the UUID hex data using our hex decoder that is SIMD-aware. We
>
> The relevant info at this point is not how hex_decode_safe() works --
> that's internal to that function and the caller doesn't (and
> shouldn't) need to know about it. It might be relevant to say that if
> we've gotten this far the fast path is likely to be successful. That
> then logically leads in to the mention of error handling. Speaking of,
> 'escontext' and 'esctx' are confusingly similar -- it should be
> obvious from the name what the purpose of the private one is. Maybe
> 'scratch' or 'private' as a prefix.

Thank you for reviewing the patch! I agree with all the above comments.

I've attached the updated patch.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v6-0001-Use-hex_decode_safe-to-speed-up-UUID-input.patch text/x-patch 12.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2026-08-18 20:32:31 Re: gistkillitems can LP_DEAD-mark the wrong tuples on a rescan
Previous Message Euler Taveira 2026-08-18 20:05:18 Re: [Patch] Omit virtual generated columns from test_decoding output