Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.

Joel Jacobson <joel@compiler.org>

From: "Joel Jacobson" <joel@compiler.org>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-01T13:14:58Z
Lists: pgsql-hackers

Attachments

On Mon, Jul 1, 2024, at 15:11, Joel Jacobson wrote:
> Not really sure why. Maybe the code I tried can be optimized further:

If anyone want experiment with the int128 version,
here is a patch that adds a separate numeric_mul_patched() function,
so it's easier to benchmark against the unmodified numeric_mul().

/Joel

Commits

  1. Optimise numeric multiplication for short inputs.

  2. Optimise numeric division for 3 and 4 base-NBASE digit divisors.

  3. Optimise numeric division for one and two base-NBASE digit divisors.