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

Faster report merging through mutating objects #3236

Merged
merged 3 commits into from
Jun 22, 2018
Merged

Faster report merging through mutating objects #3236

merged 3 commits into from
Jun 22, 2018

Conversation

bboreham
Copy link
Collaborator

@bboreham bboreham commented Jun 22, 2018

When we know we have the only reference to a Report or Node object we can avoid copying the data to change it. Add "Unsafe" variants of various Merge operations which mutate the receiver, and a new Merger which takes advantage of them.

Benchmarks:

BenchmarkReportMerge-2 	       2	 608175373 ns/op	257994508 B/op	 1403665 allocs/op
BenchmarkReportFastMerge-2     3	 368993238 ns/op	110116594 B/op	  887828 allocs/op
BenchmarkSmartMerger-2 	      50	  28800741 ns/op	12794115 B/op	   58118 allocs/op
BenchmarkDumbMerger-2  	      20	 172918072 ns/op	54793384 B/op	  208674 allocs/op
BenchmarkFastMerger-2  	     500	   3997132 ns/op	  740686 B/op	   21410 allocs/op

Further refinements can be made by adding UnsafeMerge on MetricTemplates, etc., though this should be guided by profiling.

Copy link
Member

@rade rade left a comment

Choose a reason for hiding this comment

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

pls squash out the lint fix.

} else {
cp[k] = v
(*n)[k] = v

This comment was marked as abuse.

This comment was marked as abuse.

bboreham added 3 commits June 22, 2018 11:59
When we know we have the only reference to a Report or Node object we
can avoid copying the data to change it. Add "Unsafe" variants of
various Merge operations which mutate the receiver, and a new Merger
which takes advantage of them.
@bboreham bboreham merged commit 3c07c93 into master Jun 22, 2018
@bboreham bboreham deleted the fast-merger branch June 22, 2018 15:37
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.

2 participants