-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Compare parameters by object value rather than string representation (Related to #2838) #2887
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
base: master
Are you sure you want to change the base?
Conversation
|
The failing exporter checks seem to be because I changed the schema of the logical group keys, is there a way I could update what verify is expecting? E.g. verify expects |
|
I guess I could have logical groups have a key for grouping and a display name for errors, but I feel this would just add unnecessary nonfunctional code |
|
You can just update the verified files. |
|
|
||
| public bool Equals(ParameterInstances? x, ParameterInstances? y) | ||
| { | ||
| return ParameterComparer.Instance.Compare(x, y) == 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.
2 values who have equivalent comparisons are not necessarily equal. You should rather implement the equality comparer properly.
Won't this not affect the CI though? |
I don't understand the question. The test compares the output of the run to the verified file. |
Sorry, didn't realize that the GitHub actions pulled tests from my PR and not master. Will implement these changes. |
This is related to issue #2838 and PR #2886, and this PR fixes #2838
Previous Behavior
Parameters and arguments passed to benchmarks were grouped into logical groups based on
ParameterInstances.ValueInfo(a string representation), which failed for types like arrays (whose string representations just contain length and element type), causing #2838. Any type where objects are not equal but can have the sameToString()was affected by this behavior.New Behavior
When using
DefaultOrdererto group benchmark cases, parameters are compared by their actual value as opposed to their string representations, leading to correct benchmark case grouping. This is done throughParameterComparer, so any parameter or custom wrapping struct for a parameter implementingIComparablewill now be properly distinguished regardless of itsToStringoverride. For anyIEnumerables (both non-generic and generic), there is now built-in functionality inParameterComparerwhich compares enumerables element-by-element for value-based equality.