-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: Fix hack by removing redundant + #17803
Conversation
Might it be best to remove the comment but leave the |
The "hack" was about actually having different internal |
That makes a lot more sense. So perhaps the PR can be updated to try to fix that problem (which would be awesome 🎉) or updated to add more information to the comment so it's clear what it refers to (which would still be 👍). |
@Trott The value At some point, 1.5 years ago, this was not the case and the type would be a string. This is no longer the case, thus we can safely remove the |
@Trott this is the code that makes it a number for all benchmarks: https://github.com/nodejs/node/blob/master/benchmark/common.js#L56 |
@BridgeAR Seems like the testcase running correctly without any use of internal n. Correct me if I am wrong. |
@sreepurnajasti The benchmark tests are not very good, as they set all the values explicitly. Unfortunately, we can't afford to run the full benchmark in our tests. |
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
Don't worry about the discusions. There is just some misunderstanding among us on how the benchmarks works, because they used to work differently.
This comment (that I wrote, as I created this benchmark) was about When you run the benchmark (e.g. @AndreasMadsen it is clear that the number coercen is obsolete and that could be removed (when I wrote this benchmark I just copied the basic parts from other benchmarks and that was a common pattern, by now I already complain about this in newer benchmarks if someone does something similar) but this PR was about trying to fix the comment. |
@BridgeAR Ah, I see. My comment in nodejs/code-and-learn#72 was about the number coercen. As you said it is obsolete but it is still in a lot of benchmarks that people copy, thus it keeps showing up. That is why I thought it would be excellent for a code-and-learn. |
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.
Just to make sure this does not land as is.
@AndreasMadsen @BridgeAR So it sounds like the |
@Trott completely agree. |
(Oh, and maybe also: The |
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
@BridgeAR Do you have some suggested text if the TODO is restored? |
@BridgeAR As per the discussion, I understood the following. Please, correct me if I misunderstood anything.
|
@BridgeAR ping!!! |
This is what I wanted: - const size = +conf.size;
+ const size = conf.size;
// TODO: Fix this "hack"
- const n = (+conf.n) / size;
+ const n = conf.n / size; |
@AndreasMadsen Agreed. But, still the hack remains as is!! So can I even fix the hack in the same pr? Or should I make another for fixing the hack whereas this includes the above proposed changes? |
Both options are acceptable. Do what you are most comfortable with. |
@sreepurnajasti the code change should look like the one @AndreasMadsen suggested. I am not aware of a good fix for my comment at the moment, otherwise I would have done that already. |
7c5467a
to
c56b547
Compare
@AndreasMadsen @BridgeAR Thanks. Done changes as per my understanding. Please review. |
@sreepurnajasti this does not fix the comment. Right now, the best patch as far as I see it would be the one from @AndreasMadsen - const size = +conf.size;
+ const size = conf.size;
// TODO: Fix this "hack"
- const n = (+conf.n) / size;
+ const n = conf.n / size; |
c56b547
to
994b9eb
Compare
@BridgeAR Thanks. Its Done. Please review!!! |
@@ -26,9 +26,9 @@ function createObj(source, add = '') { | |||
} | |||
|
|||
function main(conf) { | |||
const size = +conf.size; | |||
const size = conf.size; |
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.
@BridgeAR Can I remove this line and replace size with conf.size as it is only used in two places(31,34)?
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.
If you want to, yes. But I think it is not necessary.
I just want to make sure that no other changes are needed. If so, can someone run CI please. |
@@ -26,9 +26,9 @@ function createObj(source, add = '') { | |||
} | |||
|
|||
function main(conf) { | |||
const size = +conf.size; | |||
const size = conf.size; |
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.
If you want to, yes. But I think it is not necessary.
Landed in f6ae451 |
PR-URL: nodejs#17803 Refs: nodejs/code-and-learn#72 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
@sreepurnajasti thanks for being patient! :-) |
@BridgeAR @AndreasMadsen @Trott Thank you very much for assisting!! |
@sreepurnajasti Sorry, there was so much confusion. I'm glad it worked out :) |
PR-URL: #17803 Refs: nodejs/code-and-learn#72 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #17803 Refs: nodejs/code-and-learn#72 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #17803 Refs: nodejs/code-and-learn#72 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: nodejs#17803 Refs: nodejs/code-and-learn#72 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
Fixes: nodejs/code-and-learn#72
/cc @AndreasMadsen
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)