-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Fix benchmark issues #7311
Fix benchmark issues #7311
Conversation
/cc @AndreasMadsen |
Can you explain the motivation behind not using |
IIRC Originally I did not realize that numeric strings were being automatically converted because most benchmarks were already doing conversions and it tripped me up when I was trying to benchmark the http changes from the same PR. Specifically one of the functions being benchmarked checks the type and returns early if it's not a string. So when I started running that benchmark, I was getting unexpected results. IMHO keeping all of the values as strings makes things more consistent and the changes here are small compared to the total number of benchmarks. |
Perhaps we should just I think the current implementation (never parsing) is confusing because we allow numbers as input, but converts them to strings. To ensure consistency we would have to only allow strings, which would be rather inconvenient. |
f230ea5
to
ddf9bf7
Compare
@AndreasMadsen I've added the missing stringify in the code you referenced. I think allowing numbers in the default values is fine as it shows the intention better. |
I agree. But setting number in What I'm sugesting is that we use |
@AndreasMadsen If that were implemented it'd mean you'd have to start using escaped double quotes to force a number to be treated as a string which could be equally "confusing", for example:
|
/cc @nodejs/collaborators |
@mscdex I can understand that it is inconvenient, but you will have to explain how it is "equally confusing". Another solution could be to transfer the configuration parameters with |
IMO using |
@trevnorris We can replace |
@AndreasMadsen wouldn't each parameter know whether it should be a string or a number? |
@trevnorris A parameter could have both string and number values, but apparently there doesn't currently exists such a case. |
@AndreasMadsen Since it doesn't exist yet can we implement a rule that it can't. :) I can't think of a good reason for doing that, when it wouldn't make more sense to simply have two difference parameters. |
@trevnorris Sounds like a good idea.
A case where different types of values is used is in the assert benchmark, but is uses strings to identify the actual value. |
/cc @nodejs/collaborators Any more input on this? We already have two other open PRs that fix benchmarks fixed by this PR. |
Not sure about the |
@Trott The |
@mscdex Oh, I see. LGTM then. |
LGTM |
@mscdex I'm pretty sure the Right now if a I could be wrong (I can't check right now), but edit: based on our initial discussion that commit should just be removed. |
@mscdex Maybe land the other two commits more-or-less right now, and put the |
Numeric arguments are no longer automatically converted to numbers, so we need to explicitly convert them wherever necessary.
Previously bench.end would call process.exit(0) however this is rather confusing and indeed a few benchmarks had code that assumed otherwise. This adds process.exit(0) to the benchmarks that needs it.
ddf9bf7
to
daae7d7
Compare
@AndreasMadsen @Trott I've removed that commit. |
LGTM |
Considering the amount of issues related to this, I don't think we have the time to discuss this anymore. But I still think this is a bad fix that is only going to add confusion. I would much rather see that @trevnorris suggestion was implemented. |
@AndreasMadsen What are you referring to as "a bad fix"? The use of I'm mostly interested in seeing the |
IMHO having less magic here is better. To me, it makes it easier to think about. |
It is "Or the use of + to coerce?". Right now number inputs to The suggested fix is to infer the type from the options argument and add a rule such mixed types aren't allowed. |
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
Description of change
These commits fix some issues that exist since c570182 and 83432bf.