Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Joel Jacobson <joel@compiler.org>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-03T12:22:35Z
Lists: pgsql-hackers
On Mon, Jul 1, 2024 at 6:19 PM Dean Rasheed <dean.a.rasheed@gmail.com> wrote: > Repeating your benchmark where both numbers have up to 2 NBASE-digits, > this new approach was slightly faster: > > SELECT SUM(num1*num2) FROM bench_mul_var; -- HEAD > Time: 4762.990 ms (00:04.763) > Time: 4332.166 ms (00:04.332) > Time: 4276.211 ms (00:04.276) > Time: 4247.321 ms (00:04.247) > Time: 4166.738 ms (00:04.167) > > SELECT SUM(num1*num2) FROM bench_mul_var; -- v2 patch > Time: 4398.812 ms (00:04.399) > Time: 3672.668 ms (00:03.673) > Time: 3650.227 ms (00:03.650) > Time: 3611.420 ms (00:03.611) > Time: 3534.218 ms (00:03.534) > > SELECT SUM(num1*num2) FROM bench_mul_var; -- this patch > Time: 3350.596 ms (00:03.351) > Time: 3336.224 ms (00:03.336) > Time: 3335.599 ms (00:03.336) > Time: 3336.990 ms (00:03.337) > Time: 3351.453 ms (00:03.351) I don't have any particular technical insight on this topic, but I just want to mention that I'm excited about the work. Numeric performance can be painfully slow, and these seem like quite significant speedups that will affect lots of real-world cases. -- Robert Haas EDB: http://www.enterprisedb.com
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