Re: speed up text_position() for utf-8

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: speed up text_position() for utf-8
Date: 2021-12-15 16:43:37
Message-ID: CAFBsxsGAcmsHFsiNh=TywjkwOgebbT87hsrPRkgf-b=HLO=vjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:

> The test is attached and the test function is part of the patch. It's
> based on the test used in the commit above. The test searches for a
> string that's at the end of a ~1 million byte string. This is on gcc
> 11 with 2-3 runs to ensure repeatability, but I didn't bother with
> statistics because the differences are pretty big:
>
> patch | no match | ascii | mulitbyte
> -----------------------------------------+----------+-------+-----------
> PG11 | 1120 | 1100 | 900
> master | 381 | 2350 | 1900
> DFA | 386 | 1640 | 1640
> branchless utf mblen | 387 | 4100 | 2600
> inline pg_utf_mblen() | 380 | 1080 | 920
> inline pg_utf_mblen() + ascii fast path | 382 | 470 | 918

I failed to mention that the above numbers are milliseconds, so
smaller is better.

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2021-12-15 16:44:56 Re: Privilege required for IF EXISTS event if the object already exists
Previous Message Alvaro Herrera 2021-12-15 16:42:55 Re: logical decoding and replication of sequences