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

module: refactor to avoid unsafe array iteration #36680

Merged
merged 1 commit into from
Jan 6, 2021

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Dec 29, 2020

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

@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Dec 29, 2020
@PoojaDurgad PoojaDurgad added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 31, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 31, 2020
@PoojaDurgad
Copy link
Contributor

@aduh95
Copy link
Contributor Author

aduh95 commented Jan 2, 2021

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/851/ (queued, will 404 until it starts)

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 if benchmarks are OK

@aduh95
Copy link
Contributor Author

aduh95 commented Jan 2, 2021

Benchmark didn't show any significant perf improvement or regression:

                                                                                   confidence improvement accuracy (*)    (**)   (***)
 module/module-loader.js cache='false' n=1000 files=500 dir='abs' name='/'                 **     -4.18 %       ±2.74%  ±3.65%  ±4.74%
 module/module-loader.js cache='true' n=1 files=500 dir='abs' name='/'                     **      6.20 %       ±4.37%  ±5.88%  ±7.79%
                                                                                   confidence improvement accuracy (*)    (**)   (***)
 module/module-loader-circular.js n=10000                                                         -1.26 %       ±3.27%  ±4.35%  ±5.67%
 module/module-loader-deep.js cache='false' files=1000 ext=''                                      1.15 %       ±3.53%  ±4.70%  ±6.11%
 module/module-loader-deep.js cache='false' files=1000 ext='.js'                                  -0.30 %       ±3.82%  ±5.08%  ±6.61%
 module/module-loader-deep.js cache='true' files=1000 ext=''                                      -4.85 %       ±5.63%  ±7.54%  ±9.92%
 module/module-loader-deep.js cache='true' files=1000 ext='.js'                                   -1.06 %      ±10.95% ±14.57% ±18.98%
 module/module-loader.js cache='false' n=1000 files=500 dir='abs' name='/'                 **     -4.18 %       ±2.74%  ±3.65%  ±4.74%
 module/module-loader.js cache='false' n=1000 files=500 dir='abs' name=''                          0.70 %       ±3.48%  ±4.63%  ±6.03%
 module/module-loader.js cache='false' n=1000 files=500 dir='abs' name='/index.js'                 3.03 %       ±5.00%  ±6.69%  ±8.78%
 module/module-loader.js cache='false' n=1000 files=500 dir='rel' name='/'                         1.81 %       ±5.89%  ±7.91% ±10.43%
 module/module-loader.js cache='false' n=1000 files=500 dir='rel' name=''                          1.61 %       ±4.77%  ±6.37%  ±8.33%
 module/module-loader.js cache='false' n=1000 files=500 dir='rel' name='/index.js'                -1.54 %       ±3.50%  ±4.66%  ±6.07%
 module/module-loader.js cache='false' n=1 files=500 dir='abs' name='/'                           -0.47 %       ±5.77%  ±7.69% ±10.02%
 module/module-loader.js cache='false' n=1 files=500 dir='abs' name=''                            -0.13 %       ±8.44% ±11.23% ±14.61%
 module/module-loader.js cache='false' n=1 files=500 dir='abs' name='/index.js'                   -2.37 %       ±5.13%  ±6.83%  ±8.89%
 module/module-loader.js cache='false' n=1 files=500 dir='rel' name='/'                           -0.35 %       ±4.47%  ±5.94%  ±7.73%
 module/module-loader.js cache='false' n=1 files=500 dir='rel' name=''                            -2.24 %       ±4.92%  ±6.55%  ±8.52%
 module/module-loader.js cache='false' n=1 files=500 dir='rel' name='/index.js'                    1.31 %       ±4.47%  ±5.95%  ±7.74%
 module/module-loader.js cache='true' n=1000 files=500 dir='abs' name='/'                         -2.17 %       ±2.28%  ±3.04%  ±3.95%
 module/module-loader.js cache='true' n=1000 files=500 dir='abs' name=''                          -0.13 %       ±1.59%  ±2.11%  ±2.75%
 module/module-loader.js cache='true' n=1000 files=500 dir='abs' name='/index.js'                  1.39 %       ±4.52%  ±6.08%  ±8.05%
 module/module-loader.js cache='true' n=1000 files=500 dir='rel' name='/'                         -1.12 %       ±2.06%  ±2.77%  ±3.64%
 module/module-loader.js cache='true' n=1000 files=500 dir='rel' name=''                           0.29 %       ±2.18%  ±2.91%  ±3.78%
 module/module-loader.js cache='true' n=1000 files=500 dir='rel' name='/index.js'                 -0.66 %       ±5.76%  ±7.66%  ±9.97%
 module/module-loader.js cache='true' n=1 files=500 dir='abs' name='/'                     **      6.20 %       ±4.37%  ±5.88%  ±7.79%
 module/module-loader.js cache='true' n=1 files=500 dir='abs' name=''                             -3.04 %       ±5.49%  ±7.32%  ±9.53%
 module/module-loader.js cache='true' n=1 files=500 dir='abs' name='/index.js'                     3.04 %       ±4.17%  ±5.57%  ±7.30%
 module/module-loader.js cache='true' n=1 files=500 dir='rel' name='/'                             0.78 %       ±4.51%  ±6.00%  ±7.82%
 module/module-loader.js cache='true' n=1 files=500 dir='rel' name=''                             -2.94 %       ±3.47%  ±4.64%  ±6.09%
 module/module-loader.js cache='true' n=1 files=500 dir='rel' name='/index.js'                    -1.87 %       ±5.52%  ±7.41%  ±9.77%

Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case there are 29 comparisons, you can thus
expect the following amount of false-positive results:
  1.45 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.29 false positives, when considering a   1% risk acceptance (**, ***),
  0.03 false positives, when considering a 0.1% risk acceptance (***)

@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 Jan 3, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 3, 2021
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 6, 2021
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 6, 2021
PR-URL: nodejs#36680
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@aduh95
Copy link
Contributor Author

aduh95 commented Jan 6, 2021

Landed in 5f2bb88

@aduh95 aduh95 merged commit 5f2bb88 into nodejs:master Jan 6, 2021
@aduh95 aduh95 deleted the module-array-iteration branch January 6, 2021 10:32
danielleadams pushed a commit that referenced this pull request Jan 12, 2021
PR-URL: #36680
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request Jan 12, 2021
codebytere added a commit to electron/electron that referenced this pull request May 19, 2021
codebytere added a commit to electron/electron that referenced this pull request May 19, 2021
codebytere added a commit to electron/electron that referenced this pull request May 20, 2021
codebytere added a commit to electron/electron that referenced this pull request May 31, 2021
codebytere added a commit to electron/electron that referenced this pull request May 31, 2021
codebytere added a commit to electron/electron that referenced this pull request Jun 8, 2021
codebytere added a commit to electron/electron that referenced this pull request Jun 9, 2021
codebytere added a commit to electron/electron that referenced this pull request Jun 10, 2021
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. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants