-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: improve performance of validateStringArray and validateBooleanArray #49756
lib: improve performance of validateStringArray and validateBooleanArray #49756
Conversation
Since you are creating a new benchmark suite, you need to also create the appropriate test for it. Similar to https://github.com/nodejs/node/blob/main/test/benchmark/test-bechmark-readline.js |
Can this please be merged? I think I improved the performance of parseFileMode and I would like to use the benchmark in this PR. function parseFileMode(value, name, def) {
value ??= def;
if (typeof value === 'string') {
if (value === '') {
throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);
}
let result = 0;
for (let i = 0; i < value.length; ++i) {
result <<= 3;
switch (value[i]) {
case '7':
result += 7;
break;
case '6':
result += 6;
break;
case '5':
result += 5;
break;
case '4':
result += 4;
break;
case '3':
result += 3;
break;
case '2':
result += 2;
break;
case '1':
result += 1;
break;
case '0':
break;
default:
throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);
}
}
return result;
}
validateUint32(value, name);
return value;
} |
It needs a benchmark run |
The failing tests have to be unrelated. Can you retrigger the tests, please? or should i rebase, because the fixes for the failing tests is in master already? |
Commit Queue failed- Loading data for nodejs/node/pull/49756 ✔ Done loading data for nodejs/node/pull/49756 ----------------------------------- PR info ------------------------------------ Title lib: improve performance of validateStringArray and validateBooleanArray (#49756) Author Aras Abbasi (@Uzlopak) Branch Uzlopak:improve-perf-array-validators -> nodejs:main Labels performance, author ready, needs-ci, needs-benchmark-ci Commits 1 - lib: improve performance of validateStringArray and validateBooleanArray Committers 1 - uzlopak PR-URL: https://github.com/nodejs/node/pull/49756 Reviewed-By: Yagiz Nizipli Reviewed-By: Trivikram Kamat ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/49756 Reviewed-By: Yagiz Nizipli Reviewed-By: Trivikram Kamat -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - lib: improve performance of validateStringArray and validateBooleanArray ℹ This PR was created on Thu, 21 Sep 2023 21:54:17 GMT ✔ Approvals: 2 ✔ - Yagiz Nizipli (@anonrig) (TSC): https://github.com/nodejs/node/pull/49756#pullrequestreview-1641142923 ✔ - Trivikram Kamat (@trivikr): https://github.com/nodejs/node/pull/49756#pullrequestreview-1641181220 ✔ Last GitHub CI successful ℹ Last Benchmark CI on 2023-09-27T13:36:16Z: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1423 ℹ Last Full PR CI on 2023-10-22T19:56:46Z: https://ci.nodejs.org/job/node-test-pull-request/55130/ - Querying data for job/node-test-pull-request/55130/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/6606164183 |
Landed in a58ffad |
PR-URL: #49756 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
PR-URL: nodejs#49756 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
PR-URL: #49756 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
instead of calling the validateString/validateBoolean function, where we are forced to create strings, which we potentially dont need, we create the string only when needed.
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1423