Created
April 24, 2024 18:38
-
-
Save alexgleason/c4d9da4473e7640ed5544decc81380fd to your computer and use it in GitHub Desktop.
Deno.KV vs lmdb-js benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lmdb from 'npm:lmdb'; | |
const kv = await Deno.openKv(); | |
const db = lmdb.open({ path: './bench.db' }); | |
await kv.set(['hello'], 'world'); | |
await db.put(['hello'], 'world'); | |
Deno.bench('DenoKv.get', async () => { | |
await kv.get(['hello']); | |
}); | |
Deno.bench('DenoKv.set', async () => { | |
await kv.set(['hello'], 'world'); | |
}); | |
Deno.bench('lmdb.get', () => { | |
db.get(['hello']); | |
}); | |
Deno.bench('lmdb.set', async () => { | |
await db.put(['hello'], 'world'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpu: AMD Ryzen 7 PRO 5850U with Radeon Graphics | |
runtime: deno 1.42.3 (x86_64-unknown-linux-gnu) | |
file:///home/alex/Downloads/kv-bench/kv.bench.ts | |
benchmark time (avg) iter/s (min … max) p75 p99 p995 | |
---------------------------------------------------------------- ----------------------------- | |
DenoKv.get 29.41 µs/iter 34,004.4 (21.44 µs … 979.2 µs) 31.83 µs 55.47 µs 64.11 µs | |
DenoKv.set 419.32 µs/iter 2,384.8 (253.62 µs … 1.45 ms) 615.63 µs 783.8 µs 863.51 µs | |
lmdb.get 298.42 ns/iter 3,350,926.1 (278.8 ns … 517.18 ns) 301.35 ns 373.32 ns 517.18 ns | |
lmdb.set 1.67 ms/iter 600.3 (567.74 µs … 8.36 ms) 1.66 ms 1.87 ms 5.83 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment