Skip to content

Commit

Permalink
chore(engine): demo
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Dec 27, 2023
1 parent 2d9bdf0 commit 98228c8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/engine/demo/benchmark.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {random} from '@alwatr/math';
import {AlwatrStorageEngine} from '../dist/main';

const db = new AlwatrStorageEngine({
name: 'junk-data',
path: 'db',
saveBeautiful: false,
devMode: false,
});

console.time('set all items');

const max = 100_000;
for (let i = 0; i < max; i++) {
db.set({
id: 'user_' + i,
fname: random.string(4, 16),
lname: random.string(4, 32),
email: random.string(8, 32),
token: random.string(16),
});
}

console.timeEnd('set all items');

console.time('get item');
const item = db.get('user_' + max / 2);
console.timeEnd('get item');
console.dir(item);

0 comments on commit 98228c8

Please sign in to comment.