Uh oh!
There was an error while loading. Please reload this page.
benchmarks: fix benchmark for url - #19084
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.
daynin
commented
Mar 2, 2018
@BridgeAR I replaced |
daynin
commented
Mar 2, 2018
@BridgeAR tell me pls, how can I add a test for a benchmark? |
daynin
commented
Mar 2, 2018
Done |
| 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.
daynin
commented
Mar 2, 2018
fbb327b to
98d406fCompare
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.
BridgeAR
commented
Mar 2, 2018
apapirovski
left a comment
There was a problem hiding this comment.
LGTM but needs a typo fix-up before landing.
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
daynin
commented
Mar 6, 2018
/cc @nodejs/collaborators Hello! Run CI for this PR, please |
apapirovski
commented
Mar 6, 2018
BridgeAR
commented
Mar 11, 2018
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>
jasnell
commented
Aug 17, 2018
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