Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(protocol): fix a performance issue #307

Merged
merged 3 commits into from
Dec 1, 2021
Merged

chore(protocol): fix a performance issue #307

merged 3 commits into from
Dec 1, 2021

Conversation

erfanium
Copy link
Member

@erfanium erfanium commented Dec 1, 2021

makes driver 4.6 times faster

test:

const times: number[] = [];

for (let i = 0; i < 100; i++) {
  const t0 = performance.now();
  const result = await col.find({}).toArray();
  const t1 = performance.now();
  assertEquals(result.length, 494); // just to make sure all docs received 
  times.push(t1 - t0);
}

const avg = times.reduce((a, b) => a + b, 0) / times.length;

console.log(took ${avg} ms);

before result: took 42.91281719999999 ms
after result: took 9.241063190000006 ms
nodejs result: 6.83 ms

@erfanium erfanium changed the title chore(protocol): fix performance issue chore(protocol): fix a performance issue Dec 1, 2021
@manyuanrong
Copy link
Member

Nice work!

@erfanium erfanium merged commit 0b2d797 into main Dec 1, 2021
@erfanium erfanium deleted the bench branch December 1, 2021 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants