Skip to content

Commit

Permalink
fix(storage): performance demo test
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Nov 17, 2022
1 parent 12226c8 commit 17b2c1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
17 changes: 3 additions & 14 deletions demo/storage-client/big-data-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,19 @@ for (let i = 0; i < max; i++) {
console.log(i);
}
await db.set({
_id: random.string(4, 16),
_updatedBy: 'demo' + i,
_id: 'demo_' + i,
_updatedBy: 'demo_' + i,
fname: random.string(4, 16),
lname: random.string(4, 32),
email: random.string(8, 32),
token: random.string(16),
});

if (i === max / 2) {
db.set({
_id: 'alimd',
_updatedBy: 'demo' + i,
fname: 'Ali',
lname: 'Mihandoost',
email: 'ali@mihandoost.com',
token: 'alimd007',
});
}
}

console.timeEnd('set all items');

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

Expand Down
17 changes: 3 additions & 14 deletions demo/storage-engine/big-data-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,19 @@ console.time('set all items');
const max = 100_000;
for (let i = 0; i < max; i++) {
db.set({
_id: random.string(4, 16),
_updatedBy: 'demo' + i,
_id: 'user_' + i,
_updatedBy: 'demo_' + i,
fname: random.string(4, 16),
lname: random.string(4, 32),
email: random.string(8, 32),
token: random.string(16),
});

if (i === max / 2) {
db.set({
_id: 'alimd',
_updatedBy: 'demo' + i,
fname: 'Ali',
lname: 'Mihandoost',
email: 'ali@mihandoost.com',
token: 'alimd007',
});
}
}

console.timeEnd('set all items');

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

Expand Down

0 comments on commit 17b2c1a

Please sign in to comment.