| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | Rui Zhao <zhaorui126(at)gmail(dot)com> |
| Cc: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, Tristan Partin <tristan(at)partin(dot)io>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add ASCII fast path to Unicode normalization functions |
| Date: | 2026-10-06 21:22:37 |
| Message-ID: | 77e57144-091a-4917-9c4f-6eff96096a70@dunslane.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2026-10-04 Su 12:42 PM, Rui Zhao wrote:
> Hi Andrew,
>
> Thanks for working on this. I tried two further optimizations on top
> of v4. They can be applied independently:
>
> 1. unicode_assigned() still calls pg_mbstrlen_with_len() on the
> remaining input, then walks it again to check each code point. 0001
> uses the byte length to walk to the end directly. This also avoids
> scanning the whole suffix before returning false for an unassigned
> code point near the beginning.
>
> 2. unicode_normalize_func() and unicode_is_normalized() allocate a C
> string for the normalization form on every call, even when the input
> is all ASCII. 0002 compares the form directly in the text value,
> preserving case-insensitive matching and rejecting extra bytes.
> It only builds a C string when reporting an invalid form.
>
> 0003 replaces the constant-folded VALUES test with stored short and
> compressed text values.
>
> Core regression and the Unicode normalization checks passed with these
> patches.
>
OK, that all looks good. The attached combines all this.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| v5-0001-Add-ASCII-fast-path-to-Unicode-normalization-func.patch | text/x-patch | 18.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2026-10-06 21:38:57 | Re: [PG19] COPY (query) TO ... (FORMAT json) uses the table's column names |
| Previous Message | Greg Burd | 2026-10-06 21:18:43 | Re: Let an ordering index scan hand its ORDER BY value to the target list |