-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 : millions and thounsand changed to n in benchmark #18917
Conversation
function main({ millions, size, args }) { | ||
const iter = millions * 1e6; | ||
function main({ n, size, args }) { | ||
const iter = n * 1e6; |
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.
Hm, it seems like the description in #18778 was not clear enough: it was not about just replacing the variable name. Instead of having millions = 1
it should be n = 1e6
, not n = 1
. That applies to all of these changes.
This also has influence on the for loops and the benchmark end call. These should be changed accordingly.
If there is a iter
variable as here, it is likely obsolete and it could be replaced with n
instead.
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.
working on it.
@juggernaut451 since you opened multiple pull requests so far: would you be so kind and please have another look at the commit guidelines? |
@BridgeAR changed the commit message. Thank you for pointing out. |
@juggernaut451 So far nothing is changed. I guess you did not push your commit. If you want to change the commit message, you have to change the commit history by force pushing. Please use |
662fbb3
to
bc65c16
Compare
@BridgeAR sorry forgot to push the message. Can you please check now? |
benchmark/es/defaultparams-bench.js
Outdated
@@ -5,7 +5,7 @@ const assert = require('assert'); | |||
|
|||
const bench = common.createBenchmark(main, { | |||
method: ['withoutdefaults', 'withdefaults'], | |||
millions: [100] | |||
n: [100e6] |
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.
I'd like to use 1e8
for consistency. (ditto throughout)
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.
@starkwang so everywhere I should replace the value of n with 1e8?
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.
I am not sure what the question stands for. Is there something unclear with the suggestion from @starkwang ?
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.
@juggernaut451 100e6
means 100 * 1e6
, 1e6
means 10^6. Thus 100e6
can be written as 1e8
.
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.
changes made. Thanks
@@ -5,7 +5,7 @@ require('../common'); | |||
const runBenchmark = require('../common/benchmark'); | |||
|
|||
runBenchmark('module', [ | |||
'thousands=.001', | |||
'n=.001', |
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.
n=1
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.
changes made. Thanks
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.
Besides the comments there are a couple of tests that still need to be changed as well. The millions
and thousands
entries should be replaced in that case.
b0.compare(b1, 0); | ||
} | ||
bench.end(iter / 1e6); | ||
bench.end(n / 1e6); |
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.
bench.end
should never say n / x
. Instead, it should always only be n
. That applies to all benchmarks and is missing in many files here.
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.
Mostly correct. There are cases where we see how many requests a server can take over 10 seconds and then we run bench.end(numberOfRequests)
but those are special cases.
benchmark/es/defaultparams-bench.js
Outdated
@@ -5,7 +5,7 @@ const assert = require('assert'); | |||
|
|||
const bench = common.createBenchmark(main, { | |||
method: ['withoutdefaults', 'withdefaults'], | |||
millions: [100] | |||
n: [100e6] |
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.
I am not sure what the question stands for. Is there something unclear with the suggestion from @starkwang ?
benchmark/timers/immediate.js
Outdated
@@ -2,113 +2,113 @@ | |||
const common = require('../common.js'); | |||
|
|||
const bench = common.createBenchmark(main, { | |||
thousands: [5000], | |||
n: [5000e3], |
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.
The comment from @starkwang applies here as well and in more places.
benchmark/timers/immediate.js
Outdated
function depth(N) { | ||
var n = 0; | ||
function depth(n) { | ||
var i = 0; |
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.
This is a independent change and is not necessary. Please change it to the way it was before to reduce churn. This applies to all these functions in this test.
benchmark/buffers/dataview-set.js
Outdated
} | ||
|
||
function benchInt(dv, fn, len, le) { | ||
function benchInt(dv, fn, n, le) { |
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.
Renaming this variable is not necessary. I would rather change it to the way as it was before to reduce churn. That applies to all functions in this test besides main
.
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.
In this const len = millions * 1e6
was defined. There is no need of len as it's value is n
. So that's why I replaced len
with n
. If I don't replace then I have to initialize the len
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.
So what I meant is that only the main
function is impacted by that change. You can keep the len
argument here and only change len / 1e6
to len
. That way there is less churn.
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.
that sounds good. Thanks :)
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.
changes made.
bench.end(n / 1e6); | ||
j++; | ||
if (j === n) | ||
bench.end(i / 1e6); |
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.
Please do not use i
but n
here and only n
and no division as mentioned in another comment. That applies to all cases in this test.
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.
changes made :)
const N = millions * 1e6; | ||
var n = 0; | ||
function main({ n }) { | ||
|
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.
Nit: please remove the line break here.
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.
changes made :)
function main({ millions }) { | ||
var n = millions * 1e6; | ||
function main({ n }) { | ||
|
||
|
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.
Please do not add double line breaks. This is a unnecessary change.
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.
changes made :)
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.
This looks quite nice now.
benchmark/buffers/dataview-set.js
Outdated
} | ||
|
||
function benchInt(dv, fn, len, le) { | ||
function benchInt(dv, fn, n, le) { |
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.
So what I meant is that only the main
function is impacted by that change. You can keep the len
argument here and only change len / 1e6
to len
. That way there is less churn.
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. Thanks, this is something that has annoyed me for a long time and confused new users, thus I'm very happy to see this is now fixed :)
Well done!
Thanks, @AndreasMadsen |
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 but needs to be rebased and there's a small nit below.
benchmark/buffers/dataview-set.js
Outdated
@@ -39,9 +39,9 @@ const mod = { | |||
setUint32: UINT32 | |||
}; | |||
|
|||
function main({ millions, type }) { | |||
function main({ n, type }) { | |||
const len = n; |
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.
This could just use n
throughout the main
function rather than creating an extra variable.
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.
It is done to reduce the churn as requested by @BridgeAR
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.
No, I actually explicitly excluded the main function in my comment ;-)
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.
making the change on the main function too
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.
changes made
1131890
to
3c15b97
Compare
Resolved :) |
can someone help me in understanding what exactly is failing? |
@juggernaut451 if you click on the CI link and scroll down to the bottom you'll see a link to If you click on that link you'll see that it failed, so you need to go to the If you click that you'll see this:
I know that this PR isn't showing that there are conflicts, but the CI does the rebase in a different way. I'm pretty sure this commit is the issue: Basically what you need to do is to squash all your commits into one commit, and then rebase that on top of the upstream master branch. |
3c15b97
to
faece08
Compare
faece08
to
5a5c6a0
Compare
Thank you @gibfahn |
@starkwang can you please re run the CI |
CI is currently locked down for the security release: #19642 |
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.
"thousands" is misspelled in the commit message.
Perhaps |
New CI https://ci.nodejs.org/job/node-test-pull-request/14134/ @ChALkeR there are only very few lines that touch |
Landed in b80da63 🎉 |
PR-URL: nodejs#18917 Fixes: nodejs#18778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
PR-URL: #18917 Fixes: #18778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This is refactoring of the benchmark.
It contained
millions
orthousands
which is changed ton
Fixes : #18778
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test, benchmark