-
Notifications
You must be signed in to change notification settings - Fork 71
Use freelists instead of sync.Pool for value object recycling #155
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
Use freelists instead of sync.Pool for value object recycling #155
Conversation
c2b8c41 to
b321ad9
Compare
apelisse
left a comment
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 looks good, it's mostly mechanical after all. It clearly needs to be rebased/squashed though, thanks!
b321ad9 to
c9bdf8e
Compare
Thanks for looking at it so quickly. I've squashed and reduced the copy-paste in the allocator code. |
c9bdf8e to
0e517d5
Compare
|
Rebased |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: apelisse, jpbetz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Remove use of
sync.Poolentirely and add aAllocatorinterface that works like so:The freelists themselves are pooled. The typical usage is to get a freelist from a pool when starting a traversal (e.g. validationWalker or mergeWalker) and then returned at the end of the traversal.
Callers that don't opt in to use the allocator by calling the "Using" functions get heap allocation by default.
The eliminates the contention observed by
sync.Poolparticularly when concurrency is high.Test: Compare cpu=32 RunParallel benchmark that calls ObjectToTyped and then Compare, just like updater.Update does
Baseline: master + #153
/sig api-machinery
cc @apelisse @jennybuckley @lavalamp