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

lib: refactor to use more primordials in internal/histogram.js #36455

Conversation

RaisinTen
Copy link
Contributor

@RaisinTen RaisinTen commented Dec 9, 2020

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@targos
Copy link
Member

targos commented Dec 9, 2020

Why did you change private properties to symbol properties?

@jasnell
Copy link
Member

jasnell commented Dec 9, 2020

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.

Copy link
Contributor

@aduh95 aduh95 left a 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.

lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
Copy link
Contributor

@aduh95 aduh95 left a 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

lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
lib/internal/histogram.js Outdated Show resolved Hide resolved
@RaisinTen RaisinTen marked this pull request as ready for review December 10, 2020 15:23
@RaisinTen RaisinTen force-pushed the lib/refactor-to-use-more-primordials-internal/histogram.js branch from 8c6fb14 to 42a535b Compare December 10, 2020 15:23
Copy link
Contributor

@aduh95 aduh95 left a 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).

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 12, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 2020
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@Trott Trott left a 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?

@aduh95 aduh95 added the needs-benchmark-ci PR that need a benchmark CI run. label Dec 15, 2020
@Trott
Copy link
Member

Trott commented Dec 22, 2020

@Trott
Copy link
Member

Trott commented Dec 22, 2020

Not sure if perf_hooks exercised the code here, but the results are good.

07:21:09  perf_hooks/bench-eventlooputil.js method='ELU_passed' n=1000000                -0.53 %       ±2.23% ±2.97% ±3.87%
07:21:09  perf_hooks/bench-eventlooputil.js method='ELU_simple' n=1000000                 0.26 %       ±3.09% ±4.12% ±5.37%
07:21:09  perf_hooks/bench-eventlooputil.js method='idleTime' n=1000000                   0.91 %       ±4.78% ±6.36% ±8.28%

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>
@Trott Trott removed the needs-benchmark-ci PR that need a benchmark CI run. label Dec 22, 2020
@Trott Trott force-pushed the lib/refactor-to-use-more-primordials-internal/histogram.js branch from 42a535b to 1623aff Compare December 22, 2020 15:33
@Trott
Copy link
Member

Trott commented Dec 22, 2020

Landed in 1623aff

@Trott Trott merged commit 1623aff into nodejs:master Dec 22, 2020
@RaisinTen RaisinTen deleted the lib/refactor-to-use-more-primordials-internal/histogram.js branch December 22, 2020 15:47
danielleadams pushed a commit that referenced this pull request Jan 12, 2021
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>
@danielleadams danielleadams mentioned this pull request Jan 12, 2021
targos pushed a commit that referenced this pull request May 16, 2021
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>
targos pushed a commit that referenced this pull request Jun 11, 2021
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants