Re: [PATCH] Use 128-bit math to accelerate numeric division, when 8 < divisor digits <= 16

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема Re: [PATCH] Use 128-bit math to accelerate numeric division, when 8 < divisor digits <= 16
Дата
Msg-id 38f41b4d-eff7-4d6a-a1ae-28339291cd72@app.fastmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Use 128-bit math to accelerate numeric division, when 8 < divisor digits <= 16  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: [PATCH] Use 128-bit math to accelerate numeric division, when 8 < divisor digits <= 16  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
On Sun, Jan 22, 2023, at 14:25, Dean Rasheed wrote:
> I just modified the previous test you posted:
>
> \timing on
> SELECT count(numeric_div_volatile(1e131071,123456)) FROM generate_series(1,1e4);
>
> Time: 2048.060 ms (00:02.048)    -- HEAD
> Time: 2422.720 ms (00:02.423)    -- With patch
>
...
>
> Apparently it can make a difference. Probably something to do with
> having less data to move around. I remember noticing that when I wrote
> div_var_int(), which is why I split it into 2 branches in that way.

Many thanks for feedback. Nice catch! New patch attached.

Interesting, I'm not able to reproduce this on my MacBook Pro M1 Max:

SELECT version;
PostgreSQL 16devel on aarch64-apple-darwin22.2.0, compiled by Apple clang version 14.0.0 (clang-1400.0.29.202), 64-bit

SELECT count(numeric_div_volatile(1e131071,123456)) FROM generate_series(1,1e 4);
Time: 1569.730 ms (00:01.570) - HEAD
Time: 1569.918 ms (00:01.570) -- div_var_int64.patch
Time: 1569.038 ms (00:01.569) -- div_var_int64-2.patch

Just curious, what platform are you on?

/Joel
Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: run pgindent on a regular basis / scripted manner
Следующее
От: Tom Lane
Дата:
Сообщение: Re: run pgindent on a regular basis / scripted manner