-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
lib: refactor to use more primordials in internal/histogram.js #36455
lib: refactor to use more primordials in internal/histogram.js #36455
Conversation
Why did you change private properties to symbol properties? |
I presume because of the performance difference that still exists there (symbol are still faster). In this case, I would leave them as private fields. |
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.
I agree with other comments here, using a symbol doesn't seem justified. An argument could be made for #handle
/kHandle
which is exported as a symbol anyway (although that would make possible for consumers to change the handle with another object, we'd have to make sure it won't introduce issues; I'd stick with the original code to not take any risk), but I suggest reverting changes to the #map
private property.
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.
nit: it seems a good candidate for optional chaining
8c6fb14
to
42a535b
Compare
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.
LGTM as long as kHandle
is never exported to user-land (which seems to be the case).
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.
LGTM. Worth a benchmark of either quic or perf_hooks since those use this?
Not sure if perf_hooks exercised the code here, but the results are good.
|
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: nodejs#36455 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
42a535b
to
1623aff
Compare
Landed in 1623aff |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #36455 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #36455 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #36455 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes