Re: Improving and extending int128.h to more of numeric.c
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Andres Freund <andres@anarazel.de>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-07-17T07:29:53Z
Lists: pgsql-hackers
On Wed, 16 Jul 2025 at 19:23, Dean Rasheed <dean.a.rasheed@gmail.com> wrote: > > On 64-bit Linux with gcc 14.2 and native int128 support disabled I got > the following results: > > Query 1: > HEAD: 1404.096 ms > Patch: 992.818 ms > > Query 2: > HEAD: 1498.949 ms > Patch: 935.654 ms > BTW, my other motivation for doing this was to simplify the numeric code. Even if this had zero performance benefit, as long as it didn't make things any slower, I would argue that it's worth doing. The other 2 places in numeric.c that have conditional 128-bit integer code would require more complex hand-written code to replace, such as 128-bit-by-128-bit division. That's obviously doable, but perhaps not worth the effort as long as it's only those 2 numeric functions that need it. OTOH, if there's a wider demand for 128-bit integers, that might change. Regards, Dean
Commits
-
Guard against division by zero in test_int128 module.
- 7e2af1fb1118 19 (unreleased) landed
-
Extend int128.h to support more numeric code.
- d699687b329e 19 (unreleased) landed
-
Simplify non-native 64x64-bit multiplication in int128.h.
- d8a08dbee46c 19 (unreleased) landed
-
Optimise non-native 128-bit addition in int128.h.
- d9bb8ef093d6 19 (unreleased) landed
-
Refactor int128.h, bringing the native and non-native code together.
- 5761d991c984 19 (unreleased) landed
-
Convert src/tools/testint128.c into a test module.
- 8c7445a00810 19 (unreleased) landed