Update benchmark results

This commit is contained in:
luaneko 2025-01-12 00:26:38 +11:00
parent 29b79f25c0
commit 328cc63536
Signed by: luaneko
GPG Key ID: 406809B8763FF07A
2 changed files with 40 additions and 40 deletions

View File

@ -25,13 +25,13 @@ TODO: Write the documentation in more detail here.
## Benchmarks ## Benchmarks
Performance is generally on par with [postgres-js][1] and up to **5x faster** than [deno-postgres][2]. Keep in mind that database driver benchmarks are largely dependent on the database performance itself and does not necessarily represent accurate real-world performance. Performance is generally on par with [postgres.js][1] and up to **5x faster** than [deno-postgres][2]. Keep in mind that database driver benchmarks are largely dependent on the database performance itself and does not necessarily represent accurate real-world performance.
Tested on a 4 core, 2800 MHz, x86_64-pc-linux-gnu, QEMU VM, with Deno 2.1.4 and PostgreSQL 17.1 on localhost: Tested on a 4 core, 2800 MHz, x86_64-pc-linux-gnu, QEMU VM, with Deno 2.1.4 and PostgreSQL 17.1 on localhost:
Query `select * from pg_type`: Query `select * from pg_type`:
```log ```
CPU | Common KVM Processor v2.0 CPU | Common KVM Processor v2.0
Runtime | Deno 2.1.4 (x86_64-unknown-linux-gnu) Runtime | Deno 2.1.4 (x86_64-unknown-linux-gnu)
@ -39,78 +39,78 @@ benchmark time/iter (avg) iter/s (min … max) p75
--------------- ----------------------------- --------------------- -------------------------- --------------- ----------------------------- --------------------- --------------------------
group select n=1 group select n=1
pglue 8.3 ms 120.4 ( 7.2 ms … 14.4 ms) 8.5 ms 14.4 ms 14.4 ms pglue 8.8 ms 113.8 ( 7.2 ms … 11.8 ms) 9.7 ms 11.8 ms 11.8 ms
postgres-js 10.8 ms 92.3 ( 8.1 ms … 26.5 ms) 10.7 ms 26.5 ms 26.5 ms postgres.js 10.8 ms 92.3 ( 8.1 ms … 22.0 ms) 11.2 ms 22.0 ms 22.0 ms
deno-postgres 37.1 ms 26.9 ( 33.4 ms … 41.3 ms) 38.5 ms 41.3 ms 41.3 ms deno-postgres 38.9 ms 25.7 ( 23.5 ms … 51.9 ms) 40.3 ms 51.9 ms 51.9 ms
summary summary
pglue pglue
1.30x faster than postgres-js 1.23x faster than postgres.js
4.47x faster than deno-postgres 4.42x faster than deno-postgres
group select n=5 group select n=5
pglue 39.9 ms 25.1 ( 37.2 ms … 49.6 ms) 40.8 ms 49.6 ms 49.6 ms pglue 40.1 ms 25.0 ( 36.1 ms … 48.2 ms) 40.7 ms 48.2 ms 48.2 ms
postgres-js 42.4 ms 23.6 ( 36.5 ms … 61.8 ms) 44.2 ms 61.8 ms 61.8 ms postgres.js 48.7 ms 20.5 ( 38.9 ms … 61.2 ms) 52.7 ms 61.2 ms 61.2 ms
deno-postgres 182.5 ms 5.5 (131.9 ms … 211.8 ms) 193.4 ms 211.8 ms 211.8 ms deno-postgres 184.7 ms 5.4 (166.5 ms … 209.5 ms) 190.7 ms 209.5 ms 209.5 ms
summary summary
pglue pglue
1.06x faster than postgres-js 1.22x faster than postgres.js
4.57x faster than deno-postgres 4.61x faster than deno-postgres
group select n=10 group select n=10
pglue 78.9 ms 12.7 ( 72.3 ms … 88.9 ms) 82.5 ms 88.9 ms 88.9 ms pglue 80.7 ms 12.4 ( 73.5 ms … 95.4 ms) 82.2 ms 95.4 ms 95.4 ms
postgres-js 92.0 ms 10.9 ( 77.6 ms … 113.6 ms) 101.2 ms 113.6 ms 113.6 ms postgres.js 89.1 ms 11.2 ( 82.5 ms … 101.7 ms) 94.4 ms 101.7 ms 101.7 ms
deno-postgres 326.6 ms 3.1 (208.8 ms … 406.0 ms) 388.8 ms 406.0 ms 406.0 ms deno-postgres 375.3 ms 2.7 (327.4 ms … 393.9 ms) 390.7 ms 393.9 ms 393.9 ms
summary summary
pglue pglue
1.17x faster than postgres-js 1.10x faster than postgres.js
4.14x faster than deno-postgres 4.65x faster than deno-postgres
``` ```
Query `insert into my_table (a, b, c) values (${a}, ${b}, ${c})`: Query `insert into my_table (a, b, c) values (${a}, ${b}, ${c})`:
```log ```
group insert n=1 group insert n=1
pglue 303.3 µs 3,297 (165.6 µs … 2.4 ms) 321.6 µs 1.1 ms 2.4 ms pglue 259.2 µs 3,858 (165.4 µs … 2.8 ms) 258.0 µs 775.4 µs 2.8 ms
postgres-js 260.4 µs 3,840 (132.9 µs … 2.7 ms) 276.4 µs 1.1 ms 2.7 ms postgres.js 235.9 µs 4,239 (148.8 µs … 1.2 ms) 250.3 µs 577.4 µs 585.6 µs
deno-postgres 281.6 µs 3,552 (186.1 µs … 1.5 ms) 303.8 µs 613.6 µs 791.8 µs deno-postgres 306.7 µs 3,260 (198.8 µs … 1.3 ms) 325.9 µs 1.0 ms 1.3 ms
summary summary
pglue pglue
1.17x slower than postgres-js 1.10x slower than postgres.js
1.08x slower than deno-postgres 1.18x faster than deno-postgres
group insert n=10 group insert n=10
pglue 1.1 ms 878.5 (605.5 µs … 3.2 ms) 1.1 ms 2.2 ms 3.2 ms pglue 789.7 µs 1,266 (553.2 µs … 2.7 ms) 783.4 µs 2.4 ms 2.7 ms
postgres-js 849.3 µs 1,177 (529.5 µs … 10.1 ms) 770.6 µs 3.0 ms 10.1 ms postgres.js 755.6 µs 1,323 (500.5 µs … 3.4 ms) 795.0 µs 2.8 ms 3.4 ms
deno-postgres 2.3 ms 439.4 ( 1.4 ms … 4.9 ms) 2.5 ms 4.1 ms 4.9 ms deno-postgres 2.2 ms 458.1 ( 1.6 ms … 5.2 ms) 2.3 ms 4.8 ms 5.2 ms
summary summary
pglue pglue
1.34x slower than postgres-js 1.04x slower than postgres.js
2.00x faster than deno-postgres 2.76x faster than deno-postgres
group insert n=100 group insert n=100
pglue 8.3 ms 121.0 ( 5.0 ms … 13.6 ms) 9.3 ms 13.6 ms 13.6 ms pglue 5.8 ms 172.0 ( 3.2 ms … 9.9 ms) 6.8 ms 9.9 ms 9.9 ms
postgres-js 13.0 ms 76.7 ( 9.0 ms … 26.9 ms) 14.1 ms 26.9 ms 26.9 ms postgres.js 13.0 ms 76.8 ( 8.6 ms … 20.8 ms) 15.4 ms 20.8 ms 20.8 ms
deno-postgres 19.8 ms 50.5 ( 14.2 ms … 31.8 ms) 22.5 ms 31.8 ms 31.8 ms deno-postgres 18.5 ms 54.1 ( 14.3 ms … 32.1 ms) 20.0 ms 32.1 ms 32.1 ms
summary summary
pglue pglue
1.58x faster than postgres-js 2.24x faster than postgres.js
2.40x faster than deno-postgres 3.18x faster than deno-postgres
group insert n=200 group insert n=200
pglue 15.1 ms 66.2 ( 9.4 ms … 21.1 ms) 16.8 ms 21.1 ms 21.1 ms pglue 8.8 ms 113.4 ( 6.0 ms … 14.1 ms) 10.0 ms 14.1 ms 14.1 ms
postgres-js 27.8 ms 36.0 ( 22.5 ms … 39.2 ms) 30.2 ms 39.2 ms 39.2 ms postgres.js 28.2 ms 35.5 ( 21.1 ms … 47.0 ms) 29.6 ms 47.0 ms 47.0 ms
deno-postgres 40.6 ms 24.6 ( 33.5 ms … 51.4 ms) 42.2 ms 51.4 ms 51.4 ms deno-postgres 37.0 ms 27.0 ( 32.0 ms … 48.1 ms) 39.4 ms 48.1 ms 48.1 ms
summary summary
pglue pglue
1.84x faster than postgres-js 3.20x faster than postgres.js
2.68x faster than deno-postgres 4.20x faster than deno-postgres
``` ```
[1]: https://github.com/porsager/postgres [1]: https://github.com/porsager/postgres

View File

@ -60,7 +60,7 @@ for (const n of [1, 5, 10]) {
}); });
Deno.bench({ Deno.bench({
name: `postgres-js`, name: `postgres.js`,
group: `select n=${n}`, group: `select n=${n}`,
async fn(b) { async fn(b) {
await bench_select(b, n, () => c_pgjs`select * from pg_type`); await bench_select(b, n, () => c_pgjs`select * from pg_type`);
@ -95,7 +95,7 @@ for (const n of [1, 10, 100, 200]) {
}); });
Deno.bench({ Deno.bench({
name: `postgres-js`, name: `postgres.js`,
group: `insert n=${n}`, group: `insert n=${n}`,
async fn(b) { async fn(b) {
await c_pgjs`begin`; await c_pgjs`begin`;