Skip to content

Commit 32f3d86

Browse files
committed
Restore compression with lmdb, code cleanup
1 parent eda121f commit 32f3d86

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- name: Run benchmarks
7878
env:
7979
BENCHMARK_MODE: ${{ github.event.inputs.mode || 'essential' }}
80-
run: pnpm bench --passWithNoTests
80+
run: pnpm bench
8181

8282
- name: Upload benchmark results as artifact
8383
if: always() && hashFiles('benchmark-results.json') != ''

benchmark/realistic-load.bench.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
type LMDBDatabase
77
} from './setup.js';
88
import type { RocksDatabase } from '../dist/index.mjs';
9-
import { threadId } from 'worker_threads';
109

1110
const DELETE_RATIO = 0.2;
1211
const NUM_KEYS = 5_000;
@@ -25,7 +24,6 @@ describe('Realistic write load with workers', () => {
2524
ctx.log = log;
2625
},
2726
async bench({ db, log }) {
28-
let id = Math.random();
2927
for (let i = 0; i < ITERATIONS; i++) {
3028
await db.transaction((txn) => {
3129
const key = Math.floor(Math.random() * NUM_KEYS).toString();

benchmark/setup.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { RocksDatabase, RocksDatabaseOptions } from '../dist/index.mjs';
2-
import { tmpdir } from 'node:os';
32
import { join } from 'node:path';
43
import * as lmdb from 'lmdb';
54
import { randomBytes } from 'node:crypto';
@@ -68,7 +67,7 @@ export function benchmark(type: string, options: any): void {
6867
if (type === 'rocksdb') {
6968
ctx = { db: RocksDatabase.open(dbPath, dbOptions), mode };
7069
} else {
71-
ctx = { db: lmdb.open({ path: dbPath, ...dbOptions }), mode };
70+
ctx = { db: lmdb.open({ path: dbPath, compression: true, ...dbOptions }), mode };
7271
}
7372
}
7473
if (typeof setup === 'function') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "module",
1616
"gypfile": true,
1717
"scripts": {
18-
"bench": "cross-env CI=1 vitest bench --outputJson benchmark-results.json",
18+
"bench": "cross-env CI=1 vitest bench --passWithNoTests --outputJson benchmark-results.json",
1919
"bench:bun": "cross-env CI=1 bun --bun bench",
2020
"bench:deno": "cross-env CI=1 deno run --allow-all --sloppy-imports ./node_modules/vitest/vitest.mjs bench",
2121
"build": "pnpm build:bundle && pnpm rebuild",

0 commit comments

Comments
 (0)