-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MemProf] Reduce cloning overhead by sharing nodes when possible (#99…
…832) When assigning calls to nodes while building the graph, we can share nodes between multiple calls in some cases. Specifically, when we process the list of calls that had the same stack ids (possibly pruned, because we are looking at the stack ids that actually had nodes in the graph due to stack ids in the pruned allocation MIBs), for calls that are located in the same function, we know that they will behave exactly the same through cloning and function assignment. Therefore, instead of creating nodes for all of them (requiring context id duplication), keep a list of additional "matching calls" on the nodes. During function assignment we simply update all the matching calls the same way as the primary call. This change not only reduces the number of nodes (both original and cloned), but also greatly reduces the number of duplicated context ids and the time to propagate them. For a large target, I measured a 25% peak memory reduction and 42% time reduction.
- Loading branch information
1 parent
7e1fcf5
commit 055e431
Showing
1 changed file
with
109 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters