-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
benchmark: check end() argument to be > 0 #12030
Conversation
|
I think the CI failure is not related to #11972, because #11979 set the dur to 0, which means the benchmark will be ended in next timeout(0) and won't have much time to do anything, so it's normal to get a rate=0. To fix this error test/sequential/test-benchmark-net.js will need to set the |
cc @Trott |
@vsemozhetbyt Sorry, I was not being clear. |
@joyeecheung Yes, thank you. Sorry, it was my misunderstanding. |
@joyeecheung I've set it to I will launch new CI. |
@joyeecheung I am not sure how to see the needed output in proper way, but I can see here now (the same here for failed Label (click me):
|
Perhaps instead of setting the duration to a small positive value, we can add a CLI option to turn off the zero-check? It could default to "use the check" but the tests can turn the check off. The option would be used only for the tests, I suppose, where we're not really interested in getting a benchmark but just confirming that benchmark code can run. |
@vsemozhetbyt You mean catch the errors in tests? We wouldn't. Or we could write a separate test perhaps. I'm concerned about test flakiness with the |
@Trott I am not sure where this CLI option should be added — there are many different files in the various benchmark call chains. |
BTW, is there any environment variables set while tests or CI run? |
I've reverted the change for |
Is it safe to check |
Maybe set an environment variable (say const child = fork(runjs, ['--set', 'dur=0.2', 'net'],
{env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); Then check for Then you can write a test for this change that invokes a benchmark in a way that's guaranteed to get 0 results ( |
@Trott Done. New CI: https://ci.nodejs.org/job/node-test-pull-request/7038/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
CI is OK and complete, but two checks have hung here in the interactive table. Is there a way to forcibly update it? |
Not that I know of. This is a longstanding bug. :-( |
Maybe we can make a separate test for #11972 and only test windows for it? |
Why do we need the |
@vsemozhetbyt I see. Well, I think it would be better to either fix the benchmark or the test, than to add a new option. But I don't hold a strong opinion. |
I do hope that somebody with internal-Node.js-API-on-Windows experience will fix the |
@Trott Should the |
@vsemozhetbyt Since we are starting to write tests for benchmarks I think we can put a section about how to write a test for a benchmark in |
@joyeecheung So I suppose this is a subject for a different PR. I hope this variable will not be forgotten (at least I've left a link to this discussion in the issue that may become the tracking issue for benchmark tests. So if nobody has objections I will land this after 72 hours from the creation. |
Landed in 642baf4 |
I just saw this PR and I'm not convinced that not allowing zero is a good idea, especially if you're running a comparison for a benchmark script that has a lot of different configurations. All it takes is for one configuration to fail and now you have to restart it all over again.... not fun times. I understand not allowing negative numbers, because that almost certainly would never happen, especially since counters are initialized to zero in every benchmark script that I have seen. |
@mscdex |
@vsemozhetbyt I haven't verified that, but at least you'd still (hopefully) have some useable CSV data, provided you didn't pipe directly to |
Is not |
@vsemozhetbyt The problem is that's not the default... and if it were, there'd be no point in having it (unless you change it to check only for negative rates and change the environment variable name accordingly). |
So should I revert the whole commit? |
@vsemozhetbyt At the very least we could just check for < 0, which is fine by me. Let's see what other @nodejs/collaborators think. |
I agree with @mscdex |
If we test the benchmarks then this is very unlikely to happen. In my mind, it is not wrong to fail on |
should this be backported? |
ping @vsemozhetbyt |
@gibfahn I am not sure. It was frowned upon. And it is connected with benchmark tests that are not backported to v6 if I get this right. So maybe we should not backport it till we absolutely need. |
Checklist
Affected core subsystem(s)
benchmark
Refs: #11972