-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Partition benchmark run info based on added nuget packages #932
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
Conversation
|
@Shazwazza, @adamsitnik could you please review this PR? |
adamsitnik
left a 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.
Thanks for spending your time and fixing this bug!
The only thing I would like you to change before I merge this fix is:
- hashCode ^= job.Infrastructure.GetHashCode();
+ hashCode ^= job.Infrastructure.NugetReferences.GetHashCode();I am also not sure if we should have a custom collection of NugetReference type or just give up on the idea of NugetReference and use Dictionary<string, string> which would solve all of our problems (except of the primitive obsession). But we can leave that for later.
| if (job.Infrastructure.Arguments != null && job.Infrastructure.Arguments.Any()) | ||
| hashCode ^= job.Infrastructure.Arguments.GetHashCode(); | ||
| if (job.Infrastructure.NugetReferences != null) | ||
| hashCode ^= job.Infrastructure.GetHashCode(); |
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.
| hashCode ^= job.Infrastructure.GetHashCode(); | |
| hashCode ^= job.Infrastructure.NugetReferences.GetHashCode(); |
| /// <summary> | ||
| /// An ordered list of Nuget references. Does not allow duplicate references with the same PackageName. | ||
| /// </summary> | ||
| internal class NugetReferenceList : IReadOnlyCollection<NugetReference> |
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.
hmm, maybe we should give up on the idea of NugetReference and use Dictionary<string, string> instead?
Of course. So glad you caught this. Copy/paste error. I will definitely fix. Do you prefer an amended commit or a I would also be happy to explore the use of a
but if you prefer that code to be separate from the container, I can make the change. |
|
Whoops. Builds failed because I'd left |
|
You don’t need to squash, I can do it from github UI level when merging the PR. When it comes to using the dictionary we can leave it for later. I will do some PoC myself to validate this idea. |
|
I didn't realize changes were needed for the Only nitpick might be that if we keep the NugetReferenceList maybe we should make it implement IReadOnlyList instead of IReadOnlyCollection since it seems that most other collections are exposed as this and means in the test https://github.com/dotnet/BenchmarkDotNet/pull/922/files#diff-048cab01ff351e9c6602501a273532d5R480 that ElementAt doesn't need to be used an instead an indexer can be used. I ended up using IReadOnlyCollection only due to the HashSet usage since it doesn't implement IReadOnlyList |
|
I see that AppVeyor failed, but do not see an actual failure. Does the build time out after an hour? (Yup. Found the message.) I can't imagine what in my change would blow the time up, especially considering that the Travis build was as fast as usual. |
|
@blairconrad thank you! the CI failure seems to be unrelated, don't worry |
|
Yay! Thanks for the reviews and merge, folks. |
Fixes #931. Related to #922.
I tried to follow the local coding style, but my have failed. In particular, I saw no consistent method for calculating hashes. I'm happy to make any changes to conform.
The partitioner needs an implementation where package references are considered different if either name or version differ, so I amended
EqualsandGetHashCode. thenHashSetwouldn't recognize duplicate packages, so I replaced it with a custom collection. I had it throw when the nuget reference's package name is a duplicate, since configuring different package versions of the same package for one job is an error, and it seems better to fail fast rather than run with perhaps an unintended version.Thanks for considering this. Again, I'm happy to make any changes at all.