pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Extend mul_var_short() to 5 and 6-digit inputs.
Date: Thu, 15 Aug 2024 09:35:28 +0000
Message-ID: <E1seWtE-004G50-NG@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1seWtE-004G50-NG@gemulon.postgresql.org>
Permalink:  ../E1seWtE-004G50-NG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1seWtE-004G50-NG@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: dean.a.rasheed@gmail.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Extend mul_var_short() to 5 and 6-digit inputs.
  In-Reply-To: <E1seWtE-004G50-NG@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox