-
Notifications
You must be signed in to change notification settings - Fork 48
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
Optimize garbage collection #80
Comments
Another thing to look into is if we an make fewer calls to |
#102 addresses the performance issues, but it also means that each value now comes along with some extra memory required for the intrusive linked lists used by |
I ran some tests with |
All right, so here is what I am thinking.
Batch reuse would be optional. If a read-heavy program cares more about memory usage than allocation overhead, it can opt-out. Retirement will then always involve allocating a node, and reclamation will involve an extra dealloc. Another option would be for the thread that reclaims a batch to first try to take it for itself, before returning it to the collector. However, I'm not sure this optimization is worthwhile as reader threads may end up taking batches that they never end up using, and writer threads are likely to already have taken a batch. Using this strategy, |
In the discussion about performance improvements (#50), a point that arose repeatedly is the impact of the
crossbeam_epoch
-based garbage collection we use to track map entries (nodes and values).There are several angles from which we might look at reducing this impact. This issue is meant to be for discussion and changes around how and when our code interacts with garbage collection. Ideas floated in #72 (review) and previous comments may serve as a starting point. They include:
crossbeam_epoch
, e.g. in the form ofdefer_destroy
, out of critical sections in favour of a simpler collection mechanism for things to be deleted. The collected entities could then be handed of to garbage collection after dropping the lock for the critical section.It is yet unclear whether this would yield a significant improvement over calling
defer_destroy
directly from within the critical section (as happens currently), as crossbeam essentially also stores a closure for the drop and takes some measures to optimize the storage of these closures (for example, a deferred closure only requires a heap allocation if it exceeds a certain size).defer_destroy
and its usage itself. See again Implement TreeBins #72 (review)The text was updated successfully, but these errors were encountered: