Optimize numeric multiplication for one and two base-NBASE digit multiplicands.
Joel Jacobson <joel@compiler.org>
From: "Joel Jacobson" <joel@compiler.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-01T06:04:06Z
Lists: pgsql-hackers
Attachments
- 0001-optimize-numeric-mul_var-small-factors.patch (application/octet-stream) patch 0001
Hello hackers, Attached patch introduces an optimization of mul_var() in numeric.c, targeting cases where the multiplicands consist of only one or two base-NBASE digits. Such small multiplicands can fit into an int64 and thus be computed directly, resulting in a significant performance improvement, between 26% - 34% benchmarked on Intel Core i9-14900K. This optimization is similar to commit d1b307eef2, that also targeted one and two base-NBASE digit operands, but optimized div_var(). Regards, Joel
Commits
-
Optimise numeric multiplication for short inputs.
- ca481d3c9ab7 18.0 landed
-
Optimise numeric division for 3 and 4 base-NBASE digit divisors.
- 0aa38db56bf4 16.0 cited
-
Optimise numeric division for one and two base-NBASE digit divisors.
- d1b307eef281 15.0 cited