| From: | Quan Zongliang <quanzongliang(at)yeah(dot)net> |
|---|---|
| To: | zengxx <xiangxin_zeng(at)qq(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] numeric: canonicalize wide digit accumulation |
| Date: | 2026-10-13 00:51:40 |
| Message-ID: | b19dacad-fc33-4aad-a0c5-818ceac2f8e9@yeah.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 10/11/26 12:16 AM, zengxx wrote:
> Hi,
>
> While looking at wide numeric aggregates, I found that the digit
> accumulation loop in accum_sum_add() did not auto-vectorize. It advances
> two indexes together:
>
> for (val_i = 0; val_i < val_ndigits; val_i++)
> {
> accum_digits[i] += (int32) val_digits[val_i];
> i++;
> }
>
> The attached patch advances the destination pointer once before the loop:
>
> accum_digits += accum->weight - val->weight;
> for (val_i = 0; val_i < val_ndigits; val_i++)
> accum_digits[val_i] += (int32) val_digits[val_i];
>
LGTM
> Performance below is from one local machine, so it is motivation rather
> than a universal claim. The machine is WSL2/Linux on an i5-14400F using
> GCC 13.3.0. Each number is the median of 11 runs after 2 warmups; base
> and feature used identical task files, settings, row counts, and
> disposable clusters.
> Please provide the test script. So as to facilitate testing on other
platforms.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayush Tiwari | 2026-10-13 01:30:52 | Re: [PATCH] Clear walsender reader pointers after cleanup |
| Previous Message | Bruce Momjian | 2026-10-13 00:46:36 | Re: First draft of PG 19 release notes |