Use a freelist for struct types - #44
Merged
Merged
Conversation
This adds a freelist for "small" struct objects (currently defined as `1 <= nfields <= 10`). Structs are added to the freelist during deallocation, up to a per-size cap (currently 2000). Structs can then be allocated from the freelist (if non-empty), skipping the cost of a malloc. To prevent keeping old pages around, the freelist is cleared every major GC collection. This is done by a hook added to the module `m_traverse` (since modules should persist for the lifetime of the program, they'll usually be in the largest generation). During high load, this leads to a measurable (4-6%) performance improvement on deserialization.
Member
Author
|
Running the benchmark script gives: master This PR For 10% and 4% speedups on load time respectively. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds a freelist for "small" struct objects (currently defined as
1 <= nfields <= 10). Structs are added to the freelist duringdeallocation, up to a per-size cap (currently 2000). Structs can then be
allocated from the freelist (if non-empty), skipping the cost of a
malloc.
To prevent keeping old pages around, the freelist is cleared every major
GC collection. This is done by a hook added to the module
m_traverse(since modules should persist for the lifetime of the program, they'll
usually be in the largest generation).
During high load, this leads to a measurable (4-6%) performance
improvement on deserialization.