-
Notifications
You must be signed in to change notification settings - Fork 449
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 the number of memory allocations in def-use #4904
Merged
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4d0f982
Explicitly track lifetime of AllDefinitions
asl 6c0efd0
Pass non-null objects by reference
asl f1f182f
Reduce amount of memory allocations by using sane data structures
asl 28da061
Switch to flat_map with inline storage for fieldLocations
asl 9b9b724
Ensure only StorageFactory could access StorageLocation internals, the
asl 13cfd18
Reduce the size of StorageLocation by 8 bytes via removing the debug …
asl 18f9671
Ensure StorageLocations are immutable
asl b90f7ca
Ensure AllDefinitions own StorageMap
asl fb671d7
Make StorageFactory own StorageLocation's
asl feacfa9
Simplify
asl 8316736
Ensure we can iterate over canonical locations w/o memory allocation
asl 91eb2b8
Reduce number of memory allocations
asl 31c4540
Leak less
asl d01998e
Improve const-correctness
asl 023d0ae
Further reduce amount of memory allocations and leaks
asl 5a5705d
Get rid of immortal data structures holding things forever
asl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Ensure only StorageFactory could access StorageLocation internals, the
locations are immutable otherwise Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
- Loading branch information
commit 9b9b72469f754d42f185846e206d8f52a5d4179b
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm very surprised that a flat_map is faster than an hvec_map here -- for that to be true, almost all the structs/headers in the program have no more than 2-3 fields?
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.
It is not about "fast". It is about memory consumption. Here we do not allocate memory at all for any structs with 4 or less fields. And we resort to memory allocation for anything more. But yes, normally small flat maps have comparable speed to hash maps and, as far as I can see, most structs are small. There are certainly large ones but they are much rare. And we normally do not have struct larger than, say, 16 fields.