Skip to content
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

Lcov: benchmark & performance work #270

Merged
merged 3 commits into from
Jan 8, 2018
Merged

Lcov: benchmark & performance work #270

merged 3 commits into from
Jan 8, 2018

Conversation

wfleming
Copy link
Contributor

@wfleming wfleming commented Dec 6, 2017

Changes made while investigating #264, please see commits for details.

Motivated as useful by #264
@CLAassistant
Copy link

CLAassistant commented Dec 6, 2017

CLA assistant check
All committers have signed the CLA.

While investigating #264, this popped out as low-hanging fruit: calling
`CalcLineCounts` on a source file repeatedly is just wasted work. In
fact, I don't think the formatter needs to call this method at all: it's
already called by `Reporter.AddSourceFile`. (It's also called by
`SourceFile.MarshalJSON`, so I think there's more inefficiency there to
root out, but we can at least get down to calling it 2 times rather than
`LOC + 2` times.)
Similar to the previous commit, looking for perf wins this is another
bit of low hanging fruit: `HEAD` should not change while the test
reporter is running. (If it did, I don't think we can even guarantee any
kind of sensible results.)
@@ -64,7 +65,6 @@ func (r Formatter) Format() (formatters.Report, error) {
}
for ln-curLine >= 1 {
sf.Coverage = append(sf.Coverage, formatters.NullInt{})
sf.CalcLineCounts()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ale7714 can you check my logic that this can be removed? Justification is in 3908eec. From what I can see there's a few other formatters also calling this method without need.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catcht! looks good to me

var sf formatters.SourceFile
curLine := 1

for _, line := range bytes.Split(b, []byte("\n")) {
if bytes.HasPrefix(line, []byte("SF:")) {
name := string(bytes.TrimSpace(bytes.TrimPrefix(line, []byte("SF:"))))
var gitHead, _ = env.GetHead()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! this was a super oversight on my part 🤦‍♀️
i think we can probably improve this on other formatters as well.

@ale7714
Copy link
Contributor

ale7714 commented Dec 6, 2017

@wfleming you can run make test-lcov and that will upload a report to CC in case you want/need to double check anything.

@wfleming wfleming changed the title WIP: Lcov: benchmark & performance work Lcov: benchmark & performance work Jan 5, 2018
@wfleming wfleming requested a review from ale7714 January 5, 2018 23:11
@wfleming
Copy link
Contributor Author

wfleming commented Jan 5, 2018

@ale7714 I haven't revisited this, but It think the changes as-is are worth shipping out for some improvements. Can you reviews this when you're back next week?

Copy link
Contributor

@ale7714 ale7714 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM!

@wfleming wfleming merged commit d6fef1c into master Jan 8, 2018
@wfleming wfleming deleted the will/lcov-perf branch January 8, 2018 21:14
wfleming added a commit that referenced this pull request Jan 9, 2018
@wfleming wfleming mentioned this pull request Jan 9, 2018
wfleming added a commit that referenced this pull request Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants