Conversation
BridgeAR
left a comment
There was a problem hiding this comment.
It would be great to add a test for the url benchmarks to prevent any further regressions. Would you be so kind and add one?
A alternative way of fixing this would be replacing the fn in the for loop with params[method](param);. I personally would go for that instead.
|
@BridgeAR I replaced |
|
@BridgeAR tell me pls, how can I add a test for a benchmark? |
Done |
test/parallel/test-benchmark-url.js
Outdated
|
|
||
| const runBenchmark = require('../common/benchmark'); | ||
|
|
||
| runBenchmark('url', ['n=1'], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); |
There was a problem hiding this comment.
Please also add options for all existing options in any url benchmark that exists and pass in a concrete value. Otherwise it would test for all options and that increases the runtime significantly.
So e.g. method, type...
There was a problem hiding this comment.
@BridgeAR when I add option like 'method=get' or 'method=' it throws an error:
/Users/daynin/Documents/projects/node/benchmark/url/legacy-vs-whatwg-url-get-prop.js:89
throw new Error(`Unknown method "${method}"`);
^
Error: Unknown method "get"
or
/Users/daynin/Documents/projects/node/benchmark/url/legacy-vs-whatwg-url-get-prop.js:89
throw new Error(`Unknown method "${method}"`);
^
Error: Unknown method ""
Can I specify certain benchmark for the test somehow or avoid these errors?
There was a problem hiding this comment.
Seems like you're passing in method="get" given the quotation marks in the error? Instead pass in method=get.
There was a problem hiding this comment.
@apapirovski I passed 'method=get' as an option. But I think the problem is url-searchparams-read.js has than config:
const bench = common.createBenchmark(main, {
method: ['get', 'getAll', 'has'],
param: ['one', 'two', 'three', 'nonexistent'],
n: [2e7]
})
but legacy-vs-whatwg-url-get-prop.js has that config:
const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
method: ['legacy', 'whatwg'],
n: [1e5]
})
There are two params method with different values
There was a problem hiding this comment.
Ah, sorry, didn't see the file name you mentioned. I would probably just rename the method to be something else in the legacy benchmark, if that's the only one blocking this.
|
@apapirovski @BridgeAR done |
fbb327b to
98d406f
Compare
BridgeAR
left a comment
There was a problem hiding this comment.
Not a fan of the churn for this change but the code itself looks good to me.
apapirovski
left a comment
There was a problem hiding this comment.
LGTM but needs a typo fix-up before landing.
test/parallel/test-benchmark-url.js
Outdated
There was a problem hiding this comment.
Typo? Should be href, I think.
- rename different parameters with the same names to make it possible to run tests for url benchmarks - add options in the test for all url benchmarks
|
/cc @nodejs/collaborators Hello! Run CI for this PR, please |
|
Landed in f3257dd 🎉 |
Rename different parameters with the same names to make it possible to run tests for url benchmarks. PR-URL: nodejs#19084 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rename different parameters with the same names to make it possible to run tests for url benchmarks. PR-URL: #19084 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rename different parameters with the same names to make it possible to run tests for url benchmarks. PR-URL: #19084 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rename different parameters with the same names to make it possible to run tests for url benchmarks. PR-URL: nodejs#19084 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to 8.x? If so, a separate backport PR is needed |
It fixes an error which occurs after running this test:
Error:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
benchmark