-
Notifications
You must be signed in to change notification settings - Fork 252
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
fix(NODE-3015): ObjectId.equals should use Buffer.equals for better performance #478
Conversation
@Uzlopak Hi there, thanks for submitting this PR. We still have the same concerns as with the other PR in terms of ensuring this library continues to work in the web environment (which does not have the Buffer class). In order to move forward on this issue, we'd need to make sure that this logic only runs in the node.js environment and we'd also want tests to cover the behavior. |
Why is that even an issue? As I can see you use rollup-plugin-polyfill-node and you build for browser. Also you use karma according to your package.json. You even have a package "Buffer" as dependency. So what is the real issue? Dont you trust your CI/CD pipeline? Should I have a look on your CI/CD pipeline and the builds? |
Hi @Uzlopak I made the mistake of thinking there was a difference in I still agree with @dariakp here that having some additional testing coverage would be great to ensure the behavior we expect continues to work as designed. I've pushed up some tests, and a small improvement to another section of the equality. |
Co-authored-by: Bailey Pearson <bailey.pearson@gmail.com>
Co-authored-by: Neal Beeken <neal.beeken@mongodb.com>
@baileympearson I've fixed my tests that broke when we switched to using the symbol. I brought over a helper we have in our driver that lets me obtain the symbol at the top of the tests for checking. |
This is a PR based on #287 by @siboulet but for the new typescript codebase.
I used the following benchmark:
and got the following result
So it is indeed the fastest way to compare two ObjectIds in Buffer format.
Double check the following
npm run lint
script<type>(NODE-xxxx)<!>: <description>
](https://jira.mongodb.org/browse/NODE-3015)