FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

benchmarks: fix benchmark for url by daynin · Pull Request #19084 · nodejs/node · GitHub

/ node Public

benchmarks: fix benchmark for url - #19084

Closed
daynin wants to merge 3 commits into
nodejs:masterfrom
daynin:fix-benchmark
Closed

benchmarks: fix benchmark for url#19084
daynin wants to merge 3 commits into
nodejs:masterfrom
daynin:fix-benchmark

Conversation

daynin commented Mar 2, 2018

Copy link
Copy Markdown
Contributor

It fixes an error which occurs after running this test:

node benchmark/url/url-searchparams-read.js

Error:

internal/url.js:983
      throw new errors.TypeError('ERR_INVALID_THIS', 'URLSearchParams');
      ^

TypeError [ERR_INVALID_THIS]: Value of "this" must be of type URLSearchParams
    at get (internal/url.js:983:13)
    at main (/Users/daynin/Documents/projects/node/benchmark/url/url-searchparams-read.js:21:5)
    at Benchmark.process.nextTick (/Users/daynin/Documents/projects/node/benchmark/common.js:34:28)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:678:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

benchmark

nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. url Issues and PRs related to the legacy built-in url module. labels Mar 2, 2018

BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

@BridgeAR I replaced fn by calling params[method]

daynin commented Mar 2, 2018

Copy link
Copy Markdown
Contributor Author

@BridgeAR tell me pls, how can I add a test for a benchmark?

BridgeAR commented Mar 2, 2018

Copy link
Copy Markdown
Member

E.g. https://github.com/nodejs/node/blob/master/test/parallel/test-benchmark-path.js

daynin commented Mar 2, 2018

Copy link
Copy Markdown
Contributor Author

@BridgeAR

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?

Done

Comment thread test/parallel/test-benchmark-url.js Outdated

const runBenchmark = require('../common/benchmark');

runBenchmark('url', ['n=1'], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems like you're passing in method="get" given the quotation marks in the error? Instead pass in method=get.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

@apapirovski @BridgeAR done

daynin force-pushed the fix-benchmark branch 2 times, most recently from fbb327b to 98d406f Compare March 2, 2018 17:43

BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Not a fan of the churn for this change but the code itself looks good to me.

BridgeAR commented Mar 2, 2018

Copy link
Copy Markdown
Member

BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Mar 2, 2018

apapirovski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM but needs a typo fix-up before landing.

Comment thread test/parallel/test-benchmark-url.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Typo? Should be href, I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@apapirovski yeah, of course

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@apapirovski fixed

apapirovski removed the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Mar 4, 2018
- 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

Copy link
Copy Markdown
Contributor Author

/cc @nodejs/collaborators

Hello! Run CI for this PR, please

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/13535/

BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Mar 6, 2018

Copy link
Copy Markdown
Member

Landed in f3257dd 🎉

BridgeAR closed this Mar 11, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 11, 2018
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>
targos pushed a commit that referenced this pull request Mar 17, 2018
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>
targos mentioned this pull request Mar 18, 2018
MylesBorins pushed a commit that referenced this pull request Mar 20, 2018
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>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
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

Copy link
Copy Markdown
Member

Should this be backported to 8.x? If so, a separate backport PR is needed

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 outstanding review comments, and a CI started. benchmark Issues and PRs related to the benchmark subsystem. url Issues and PRs related to the legacy built-in url module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL