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

test,benchmark: have benchmark tests confirm that only one line of output is generated per benchmark file #21046

Closed
wants to merge 3 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented May 30, 2018

This required:

  • changing benchmark tests that produced more than one line of output per benchmark file to only produce one (which is what we've always wanted anyway)

  • add a build step to MakeFile to make sure that delete the misc/function_calls benchmark will work; /cc @nodejs/build

  • make it so the benchmark test module checks the output to make sure each file only produces one line of results

Whoops, just realized I forgot to add the build step to vcbuild.bat. Marking as in progress for the moment until I fix that. (If someone wants to add a commit to the branch to do that, feel free to beat me to it. That would be awesome.)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label May 30, 2018
@Trott Trott added wip Issues and PRs that are still a work in progress. test Issues and PRs related to the tests. benchmark Issues and PRs related to the benchmark subsystem. labels May 30, 2018
Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

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

Amazing, thank you for working on this!!

child.on('exit', (code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
// This bit makes sure that each benchmark file is being sent settings such
// that the benchmark file runs just one set of options. This helps keep the
// benchmark tests from taking a long time to run. THerefore, each benchmark
Copy link
Member

Choose a reason for hiding this comment

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

Capitalization issue in "Therefore"

@Trott
Copy link
Member Author

Trott commented May 31, 2018

@Trott
Copy link
Member Author

Trott commented May 31, 2018

Hmmm...if I'm not mistaken, there is no build step for the C++ benchmark code in vcbuild.bat.

I'll probably have to create it because I don't think this will pass on Windows without it.

Maybe someone with a Windows laptop at the Collaborator Summit would like to pair on this sometime today (or just do it without me and add your commit to this branch)? It will no doubt go a lot faster if we can build locally rather than having me guess at the write vcbuild.bat incantation, testing on CI, having it not work, rinse and repeat...

@Trott
Copy link
Member Author

Trott commented May 31, 2018

@apapirovski and anyone else: The first two commits here are the PR at #21032. It might simplify things a bit if those land first (and they should land anyway, independent of this), so feel free to review that PR and maybe give an approval for fast-tracking.

Or not, and it will all land eventually.

@Trott
Copy link
Member Author

Trott commented May 31, 2018

Argh, yeah, confirmed, fails on Windows because there's no build step for the C++ benchmark code.

@joyeecheung
Copy link
Member

Instead of building misc/function_calls in the tests, I think we might as well skip it in the tests for the moment - and other addon tests to come until we work out how they should be built properly.

@Trott
Copy link
Member Author

Trott commented May 31, 2018

This is now ready to go. Discussion with other Collaborators led to the conclusion that the benchmark C++ benchmark is of little or no value and should be deleted.

@apapirovski @addaleax @joyeecheung @BridgeAR

@Trott
Copy link
Member Author

Trott commented May 31, 2018


let stdout = '';
child.stdout.on('data', (line) => {
const thisLine = line.toString();
Copy link
Member

Choose a reason for hiding this comment

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

Can we rather use child.stdout.setEncoding('utf8')? That way we don’t have to explicitly convert + we handle multi-byte characters properly, if that should ever be an issue

@Trott
Copy link
Member Author

Trott commented Jun 1, 2018

Updated with nit from @addaleax.

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

@richardlau
Copy link
Member

Hmmm...if I'm not mistaken, there is no build step for the C++ benchmark code in vcbuild.bat.

... Discussion with other Collaborators led to the conclusion that the benchmark C++ benchmark is of little or no value and should be deleted.

FYI part of #21072 proposes adding a new C++ benchmark for n-api function calls.

@gabrielschulhof
Copy link
Contributor

Measuring call-into-native is relevant for N-API, because we have to measure up to plain V8 addons. For example, #21072 has revealed a potential near-halving (49%) of the overhead of calling into a N-API addon.

@Trott Trott added blocked PRs that are blocked by other issues or PRs. and removed wip Issues and PRs that are still a work in progress. labels Jun 1, 2018
@Trott
Copy link
Member Author

Trott commented Jun 1, 2018

Marking as blocked on the N-API comments from @richardlau and @gabrielschulhof. Thanks for the information. This will probably have to find another way to deal with these things. If either of you want to add something to Makefile and vcbuild.bat such that it builds the C++ stuff as part of make test and friends, that would be awesome. Just saying. :-D

@nodejs nodejs deleted a comment from refack Jun 1, 2018
@joyeecheung
Copy link
Member

@Trott I still think it's OK to skip the addon tests for now and leave a TODO there about making the build steps work.

Trott added 3 commits June 15, 2018 13:01
Prevent misc benchmark files from running more than one benchmark
during tests.
Move C++ benchmark useful for NAPI to its own directory. This will
isolate the benchmark so it can be excluded from testing that applies to
all other benchmarks but not this one.
Check that benchmark tests are not running longer than necessary by
confirming that they only produce one set of configs to report on per
benchmark file.
@Trott
Copy link
Member Author

Trott commented Jun 15, 2018

I moved the function_call benchmark to its own directory (napi instead of misc). How's that work for people?

@Trott Trott removed the blocked PRs that are blocked by other issues or PRs. label Jun 15, 2018
@Trott
Copy link
Member Author

Trott commented Jun 15, 2018

@Trott
Copy link
Member Author

Trott commented Jun 16, 2018

@Trott
Copy link
Member Author

Trott commented Jun 16, 2018

CI is green, but I did move that one benchmark to its own directory since the last reviews, so it would be good if people who already approved this could indicate if this is still good by them... @apapirovski @jasnell @addaleax

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Still LGTM :)

Trott added a commit to Trott/io.js that referenced this pull request Jun 19, 2018
Prevent misc benchmark files from running more than one benchmark
during tests.

PR-URL: nodejs#21046
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Trott added a commit to Trott/io.js that referenced this pull request Jun 19, 2018
Move C++ benchmark useful for NAPI to its own directory. This will
isolate the benchmark so it can be excluded from testing that applies to
all other benchmarks but not this one.

PR-URL: nodejs#21046
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Trott added a commit to Trott/io.js that referenced this pull request Jun 19, 2018
Check that benchmark tests are not running longer than necessary by
confirming that they only produce one set of configs to report on per
benchmark file.

PR-URL: nodejs#21046
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@Trott
Copy link
Member Author

Trott commented Jun 19, 2018

Landed in 8944a4f...b72de3d

@Trott Trott closed this Jun 19, 2018
targos pushed a commit that referenced this pull request Jun 20, 2018
Prevent misc benchmark files from running more than one benchmark
during tests.

PR-URL: #21046
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jun 20, 2018
Move C++ benchmark useful for NAPI to its own directory. This will
isolate the benchmark so it can be excluded from testing that applies to
all other benchmarks but not this one.

PR-URL: #21046
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jun 20, 2018
Check that benchmark tests are not running longer than necessary by
confirming that they only produce one set of configs to report on per
benchmark file.

PR-URL: #21046
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@targos targos mentioned this pull request Jul 3, 2018
@Trott Trott deleted the berlin-7 branch January 13, 2022 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem. build Issues and PRs related to build files or the CI. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants