Re: speed up unicode decomposition and recomposition

Поиск
Список
Период
Сортировка
От John Naylor
Тема Re: speed up unicode decomposition and recomposition
Дата
Msg-id CAFBsxsGndjXKUOzwzK0C2aaCwqnp01Nw3YrpP-x3PPJrfCB+8Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: speed up unicode decomposition and recomposition  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: speed up unicode decomposition and recomposition  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

On Wed, Oct 14, 2020 at 8:25 PM Michael Paquier <michael@paquier.xyz> wrote:
On Wed, Oct 14, 2020 at 01:06:40PM -0400, Tom Lane wrote:
> IIUC, the only place libpq uses this is to process a password-sized string
> or two during connection establishment.  It seems quite silly to add
> 26kB in order to make that faster.  Seems like a nice speedup on the
> backend side, but I'd vote for keeping the frontend as-is.

Agreed.  Let's only use the perfect hash in the backend.  It would be
nice to avoid an extra generation of the decomposition table for that,
and a table ordered by codepoints is easier to look at.  How much do
you think would be the performance impact if we don't use for the
linear search the most-optimized decomposition table?

With those points in mind and thinking more broadly, I'd like to try harder on recomposition. Even several times faster, recomposition is still orders of magnitude slower than ICU, as measured by Daniel Verite [1]. I only did it this way because I couldn't think of how to do the inverse lookup with a hash. But I think if we constructed the hash key like

pg_hton64((code1 << 32) | code2)

and on the Perl side do something like

pack('N',$code1) . pack('N',$code2)

that might work. Or something that looks more like the C side. And make sure to use the lowest codepoint for the result. That way, we can still keep the large decomp array ordered, making it easier to keep the current implementation in the front end, and hopefully getting even better performance in the backend.


--
John Naylor
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: speed up unicode decomposition and recomposition