Re: Add ASCII fast path to Unicode normalization functions

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: 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-15 12:51:41
Message-ID: CAN55FZ2OR9G=aiUXQiiaOS2T897uX2zohczZ80u1bK0R7CNX2g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachment Content-Type Size
v2-0001-Add-ASCII-fast-path-to-Unicode-normalization-func.patch text/x-patch 9.7 KB
nocfbot-v2-0002-Return-index-at-text_ascii_check.patch text/x-patch 6.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Wei Sun 2026-09-15 12:59:33 Re: Severe performance degradation with concurrent updates due to excessive EvalPlanQual (EPQ) re‑evaluation
Previous Message Daniel Gustafsson 2026-09-15 12:18:06 Re: Trying to break online checksums with LLMs