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

util: reduce javascript call for ToUSVString #47192

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Mar 21, 2023

ToUSVString is mostly called with small inputs and optimizing it for very large strings does not reflect the real-world usage. Removing RegExpPrototypeExec from JavaScript improves things.

                                        confidence improvement accuracy (*)   (**)  (***)
util/to-usv-string.js size=10 n=100000         ***     38.74 %       ±2.10% ±2.82% ±3.73%
util/to-usv-string.js size=100 n=100000        ***      7.42 %       ±0.60% ±0.80% ±1.04%
util/to-usv-string.js size=500 n=100000        ***      1.21 %       ±0.50% ±0.66% ±0.86%

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

cc @nodejs/util

@anonrig anonrig added the performance Issues and PRs related to the performance of Node.js. label Mar 21, 2023
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Mar 21, 2023
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 21, 2023
@nodejs-github-bot
Copy link
Collaborator

@mscdex mscdex added the needs-benchmark-ci PR that need a benchmark CI run. label Mar 21, 2023
@anonrig
Copy link
Member Author

anonrig commented Mar 21, 2023

Referencing benchmark issue to for tracking: Benchmark CI is down. nodejs/build#3245

@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added the review wanted PRs that need reviews. label Mar 22, 2023
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@anonrig anonrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 22, 2023
lib/internal/util.js Show resolved Hide resolved
src/node_util.cc Show resolved Hide resolved
@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 23, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 23, 2023
@nodejs-github-bot nodejs-github-bot merged commit f51c152 into nodejs:main Mar 23, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in f51c152

@anonrig anonrig deleted the improve-to-usv-string branch March 23, 2023 15:05
@targos targos added dont-land-on-v14.x dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. labels Mar 31, 2023
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. c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js. review wanted PRs that need reviews. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants