Hi hackers,
On 02/10/2026 01:16, Andres Freund wrote:
I think it should actually be a measurable win, due to getting rid of
INSTR_TIME_GET_MICROSEC(). That's a nontrivial conversion removed from the hot
path.
We tried to benchmark the patch vs master, using the following script:
#! /bin/bash
function bench() {
printenv PG;
pkill -9 postgres
rm -fr temp_db
$PG/initdb temp_db
$PG/pg_ctl -D temp_db -o "-c shared_buffers=128kB -c
track_io_timing=on" start
$PG/pgbench -i -s 100 postgres
$PG/pgbench -S -T 4800 postgres
}
for i in {1..5}; do
PG=base_bin bench
PG=patch_bin bench
done
We used pgbench with a single connection, a single core and tried to get
PG to do as much I/O as possible by having shared_buffers=128kB and
around 1.5GB of data.
And the results we got showed a consistent increase in tps for the
patched version of the binaries:
base_bin: tps = 13304.583036 (without initial connection time)
patch_bin: tps = 13402.525290 (without initial connection time)
base_bin: tps = 13369.510071 (without initial connection time)
patch_bin: tps = 13393.105787 (without initial connection time)
base_bin: tps = 13309.703092 (without initial connection time)
patch_bin: tps = 13440.319286 (without initial connection time)
base_bin: tps = 13363.819694 (without initial connection time)
patch_bin: tps = 13457.270677 (without initial connection time)
base_bin: tps = 13335.492459 (without initial connection time)
patch_bin: tps = 13364.938596 (without initial connection time)
MEDIAN BASE: 13335.492459 tps
MEDIAN PATCHED: 13402.525290 tps
MEAN BASE: 13336.621670 tps
MEAN PATCHED: 13411.631927 tps
Note: we tried the benchmark on different machines with different cpus
and depending on how powerful the cpu is we needed to increase the
runtime duration accordingly, i.e. -T in pgbench, to start noticing a
difference.
Best Regards,
Ahmed Gouda and Bernd Reiß