Re: Optimising numeric division

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Dean Rasheed" <dean(dot)a(dot)rasheed(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimising numeric division
Date: 2024-08-23 23:35:21
Message-ID: e635b90e-21e7-4fc2-b02d-869a7b870e7a@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 24, 2024, at 00:00, Joel Jacobson wrote:
> Since statistical tools that rely on normal distributions can't be used,
> let's look at the individual measurements for (var1ndigits=3, var2ndigits=3)
> since that seems to be the biggest slowdown on both CPUs,
> and see if our level of surprise is affected.

Here is a more traditional benchmark,
which seems to also indicate (var1ndigits=3, var2ndigits=3) is a bit slower:

SELECT setseed(0);
CREATE TABLE t AS
SELECT
random(111111111111::numeric,999999999999::numeric) AS var1,
random(111111111111::numeric,999999999999::numeric) AS var2
FROM generate_series(1,1e7);
EXPLAIN ANALYZE SELECT SUM(var1/var2) FROM t;

/*
* Intel Core i9-14900K
*/

-- HEAD (ff59d5d)
Execution Time: 575.141 ms
Execution Time: 572.179 ms
Execution Time: 571.394 ms

-- v1-0001-Optimise-numeric-division-using-base-NBASE-2-arit.patch
Execution Time: 672.983 ms
Execution Time: 603.031 ms
Execution Time: 620.736 ms

/*
* AMD Ryzen 9 7950X3D
*/

-- HEAD (ff59d5d)
Execution Time: 561.349 ms
Execution Time: 516.365 ms
Execution Time: 510.782 ms

-- v1-0001-Optimise-numeric-division-using-base-NBASE-2-arit.patch
Execution Time: 659.049 ms
Execution Time: 607.035 ms
Execution Time: 600.026 ms

Regards,
Joel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Junwang Zhao 2024-08-24 02:01:37 Re: replace magic num in struct cachedesc with CATCACHE_MAXKEYS
Previous Message Tom Lane 2024-08-23 22:45:02 Re: Test 041_checkpoint_at_promote.pl faild in installcheck due to missing injection_points