-
Notifications
You must be signed in to change notification settings - Fork 258
perf(NODE-4726): bench many strings in large batch in parallel #516
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR needs a rebase and a fresh re-install of dependencies.
Let's make sure that we capture the suggested approach in the description in a comment on the follow up ticket (either NODE-4283 or a new one that captures a more specific perf improvement)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one minor thing here
46a6ff7
to
d5ca5ae
Compare
@@ -68,7 +69,8 @@ | |||
"tsd": "^0.24.1", | |||
"typescript": "^4.8.4", | |||
"typescript-cached-transpile": "0.0.6", | |||
"uuid": "^9.0.0" | |||
"uuid": "^9.0.0", | |||
"v8-profiler-next": "^1.9.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have added a lot to the lock file I'm happy to make this a "must install before launching benchmaks" style dep, much like the other versions of the BSON lib are installed with --no-save
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no strong preferences here since it's a dev dependency; though if we're intending to run perf tests in the pipeline, may be worth keeping just to avoid surprise failures
new Promise(resolve => { | ||
setTimeout(() => { | ||
resolve(bson.lib.deserialize(document, { validation: { utf8: false } })); | ||
}, 20); | ||
}) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of the setTimeout here? And why did you choose a setTimeout of 20ms specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It manufactures the delay that the driver does when we promise.all many many finds, 20ms is arbitrary, kept it low so the bench runs in a reasonable amount of time
Description
What is changing?
There's still some cruft in here, but its intentional in case someone else want to pull it down and check my work.
The issue reported does reproduce but only when we try to simulate parallelism. I don't think it is the parallelism that effects our BSON library it just offers enough load to be able to measure the difference.
The goal here isn't to fix anything but some hypothesis, some ruled out:
What is the motivation for this change?
This benchmark is meant to demonstrate the perf difference so we can follow up with fixes that can be proven to be effective.
Double check the following
npm run lint
script<type>(NODE-xxxx)<!>: <description>