Re: Add ASCII fast path to Unicode normalization functions

From: "Tristan Partin" <tristan(at)partin(dot)io>
To: "Nazir Bilal Yavuz" <byavuz81(at)gmail(dot)com>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Chao Li" <li(dot)evan(dot)chao(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add ASCII fast path to Unicode normalization functions
Date: 2026-09-18 14:52:42
Message-ID: DLIJ02ES864W.F2STNXXIH8YM@partin.io
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue Sep 15, 2026 at 8:01 AM CDT, Nazir Bilal Yavuz wrote:
> Hi,
>
> Thank you for working on this!
>
> On Tue, 15 Sept 2026 at 14:31, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>
>> On 2026-09-15 Tu 12:22 AM, Chao Li wrote:
>> >
>> > The attached is my test script.
>> >
>>
>> Great, thanks for the review and tests.
>
> What do you think about continuing from where text_ascii_check() is
> left? I wrote a patch for this and benchmarked with Chao's script.
>
> Timings are v1 vs v2, not master vs v2.
>
> # unicode_is_normalized()
>
> * all ascii: 89.115ms | 87.803ms
> * mixed: 249.239ms | 126.011ms -> improvement
> * non-ascii: 1243.496ms | 1244.052ms
> * late-non-ascii: 3632.410ms | 370.966ms -> improvement
>
> # unicode_normalize_func()
>
> * all ascii: 84.458ms | 84.636ms
> * mixed: 578.684ms | 226.093ms -> improvement
> * non-ascii: 3651.573ms | 3644.026ms
> * late-non-ascii: 10513.861ms | 942.470ms -> improvement
>
> # unicode_assigned()
>
> * all ascii: 61.147ms | 60.658ms
> * mixed: 124.193ms | 86.186ms -> improvement
> * non-ascii: 507.130ms | 510.247ms
> * late-non-ascii: 1169.617ms | 166.924ms -> improvement
>
> Do you think these results worth the additional complexity?

This is a nice change. Great idea.

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-09-18 14:52:54 Re: Track skipped tables during autovacuum and autoanalyze
Previous Message Álvaro Herrera 2026-09-18 14:46:54 Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master