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

Reduce memory usage of tracking instruction callstacks in dfg.locations #6603

Open
TomAFrench opened this issue Nov 22, 2024 · 2 comments
Open

Comments

@TomAFrench
Copy link
Member

We currently track the callstacks for each instruction in the locations field of the DataflowGraph:

locations: HashMap<InstructionId, CallStack>,

Heaptrack is reporting that inserting entries into this hashmap is using 17% of the compiler's peak memory.

Image

We should definitely not require 157MB of memory in order to track this as the number of unique callstacks is going to be relatively low. It should be relatively easy to rework this so that we don't track N different instances of the same callstack.

@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Nov 22, 2024
@jfecher
Copy link
Contributor

jfecher commented Nov 22, 2024

Hmm, are we sure it's coming from N different instances of the same callstack? I thought a im::Vector should be shared behind the scenes. I suppose it's possible these call stacks are all so small that the small vector optimization to copy them instead of sharing them is hurting us rather than helping us.

@TomAFrench
Copy link
Member Author

I'm speculating on the last bit but this memory is definitely associated with the callstacks for the instructions being inserted and I feel that something must be going awry here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants