-
Notifications
You must be signed in to change notification settings - Fork 712
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
Rewrite more Map-Reduces as Renderers to save garbage #2938
Conversation
render/render.go
Outdated
// is only ever called when m is an endpoint and we never look at endpoint counts | ||
func (ret *joinResults) addToResults(m report.Node, id string, create func(string) report.Node) { | ||
// incrementing a counter if nonblank, and updating the mapping from old ID to new ID | ||
func (ret *joinResults) addToResults(m report.Node, id string, addChildren bool, create func(string) report.Node, counters ...string) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
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.
This is quite lovely. Just a few cosmetic issues to sort out.
render/host.go
Outdated
for _, n := range nodes.Nodes { | ||
if n.Topology == Pseudo { | ||
continue // Don't propagate pseudo nodes - we do this in MapEndpoint2Host | ||
} else { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
render/process.go
Outdated
ProcessRenderer, | ||
), | ||
) | ||
var ProcessNameRenderer = CustomRenderer{Renderer: ProcessRenderer, RenderFunc: processes2Names} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
With more-renderers-b I am seeing a similar improvements in allocations as above, but no improvements in runtime: master
branch
(each line is the best result of three runs) |
This is preparatory to future refactorings: all existing calls are to Endpoints which have no children and where we don't want a Counter. We make addChildAndChildren an obvious extension of addChild even though it adds a dead code path (we never call addChildAndChildren with an endpoint).
This is more efficient as there are typically many fewer names than processes.
5ac8737
to
fc8a474
Compare
It's more efficient as many input Nodes map onto a few hosts.
fc8a474
to
1c206fb
Compare
I've re-run the benchmarks with |
MapX2Host
and to a lesser extentMapProcess2Name
have the property that they map many nodes onto fewer nodes, so looping and using the machinery injoinResults
is more effective than creating many copies of the same node and merging.Benchmarks before (c5bdebd):
after this PR: