Contents
bench/run_cost.sh results
What one run() costs, with a trivial check (select true as holds). Method: the script times
N = 2000 run() calls inside one DO block (server time, no client round trips), three times
per mode, on a throwaway server created for the run.
- Date: 2026-11-12
- Code: the SQL of tag v0.5.10 (identical on master);
bench/run_cost.shas committed in 382cd64. - PostgreSQL 13.23, built from
REL_13_STABLE05f6c9ec2c4 withCFLAGS=-O2, no assertions, default settings exceptdynamic_shared_memory_type = mmap. - Machine: AMD Ryzen AI 9 HX 370 (24 threads), 30 GiB RAM, Fedora, Linux 7.3.3; a desktop in use at the time (load average about 4), not an isolated benchmark host.
- Command:
PGHOST=<socket dir> PGPORT=<port> bash bench/run_cost.sh
| mode | what runs | per run(), 3 repetitions |
|---|---|---|
| 0.4.1 | the last version without the seal | 38.7, 40.2, 27.9 µs |
| direct | 0.5.10, the author is the caller: sealed, no frame | 160.7, 157.4, 148.5 µs |
| framed | 0.5.10, another role’s check: sealed, in a SECURITY DEFINER frame |
1657.0, 1872.7, 1721.3 µs |
So, on this machine: the seal and the rest of 0.5.10’s bookkeeping cost about 0.12 ms per
run() over 0.4.1, and the frame about 1.5 ms more. These are one machine’s numbers; re-run
the script on yours. They replace two figures the README carried without a record behind
them: “about 24 µs per run() either way” (0.5.0) and “about 0.5 ms more” for a frame (0.5.10).