From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Extend mul_var_short() to 5 and 6-digit inputs. |
Date: | 2024-08-15 09:35:28 |
Message-ID: | E1seWtE-004G50-NG@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Extend mul_var_short() to 5 and 6-digit inputs.
Commit ca481d3c9a introduced mul_var_short(), which is used by
mul_var() whenever the shorter input has 1-4 NBASE digits and the
exact product is requested. As speculated on in that commit, it can be
extended to work for more digits in the shorter input. This commit
extends it up to 6 NBASE digits (up to 24 decimal digits), for which
it also gives a significant speedup. This covers more cases likely to
occur in real-world queries, for which using base-NBASE^2 arithmetic
provides little benefit.
To avoid code bloat and duplication, refactor it a bit using macros
and exploiting the fact that some portions of the code are shared
between the different cases.
Dean Rasheed, reviewed by Joel Jacobson.
Discussion: https://postgr.es/m/9d8a4a42-c354-41f3-bbf3-199e1957db97%40app.fastmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c4e44224cf617c8cd33a734f888c045ac9575226
Modified Files
--------------
src/backend/utils/adt/numeric.c | 175 ++++++++++++++++++++++++++++------------
1 file changed, 123 insertions(+), 52 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2024-08-15 09:37:24 | pgsql: Optimise numeric multiplication using base-NBASE^2 arithmetic. |
Previous Message | Peter Eisentraut | 2024-08-15 05:14:03 | pgsql: Variable renaming in dbcommands.c |