Re: Optimising numeric division - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Optimising numeric division
Date
Msg-id e635b90e-21e7-4fc2-b02d-869a7b870e7a@app.fastmail.com
Whole thread Raw
In response to Re: Optimising numeric division  ("Joel Jacobson" <joel@compiler.org>)
Responses Re: Optimising numeric division
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Test 041_checkpoint_at_promote.pl faild in installcheck due to missing injection_points
Next
From: Junwang Zhao
Date:
Subject: Re: replace magic num in struct cachedesc with CATCACHE_MAXKEYS