-
Notifications
You must be signed in to change notification settings - Fork 386
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
Single hit #309
Single hit #309
Conversation
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
=========================================
+ Coverage 87.03% 87.1% +0.07%
=========================================
Files 31 31
Lines 3016 3033 +17
=========================================
+ Hits 2625 2642 +17
Misses 391 391 |
{ | ||
ref int location = ref HitsArray[hitLocationIndex]; | ||
if (location == 0) | ||
location = 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.
📝 The main value here is avoiding this write invalidating cache lines. OpenCover uses a configurable threshold value. I could rewrite it to use a configurable threshold, though most uses I've seen in practice either omit this value or set it to 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.
Why don't pass _singleHit
as parameter or use static var and have less methods?Inlining?
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's always a possibility to come back and do this if it proves to be equally fast. Since the expanded form is at least that fast and not difficult to work with, it seemed like the straightforward initial approach.
76be6c1
to
f9a7ce0
Compare
@tonerdo Note that OpenCover uses |
@sharwell @petli @MarcoRossignoli What are your thoughts on making this option an environment variable? It seems like an optimization detail that shouldn't be at the forefront of the primary options, kinda like how we can turn on/off tiered compilation in .NET Core |
I'm for parameter |
@tonerdo I lean towards what @MarcoRossignoli said, but I'm happy to implement it either way as long as I can use it. Keep in mind the impact is dramatic - more than 50% reduction in execution overhead for coverage runs. This translates to many minutes of build time savings for CI of large projects. |
Not strictly related only to this PR,but in general, don't you think that we've too few unit/perf testing for these core part?(I'm aware of rush to unblock scenarios) |
📝 This pull request builds on #308This pull request adds the
<CoverletSingleHit>
option (--single-hit
for the global tool), which can be used to improve the performance by only recording a single hit at each location. Where #291 brought the time down to 15.5 seconds, this pull request further reduces the execution time to ~10.3 seconds.Fixes #306