You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.
In order to reduce the rate of allocation/deallocation in unbounded channels, we should keep some number of removed nodes for quick recycling.
Here's an idea for how we might implement this:
Each unbounded channel keeps a lock-free stack of removed nodes.
If a receive operation removes a node, we should push it onto the stack. However, if the stack is larger than the live queue, that means we're wasting a lot of memory. In such cases we should deallocate the removed node as well as deallocate one node from the stack.
If a send operation needs a new node, it should first try popping one from the stack. And if the stack is empty, just allocate a fresh node.
The text was updated successfully, but these errors were encountered:
In order to reduce the rate of allocation/deallocation in unbounded channels, we should keep some number of removed nodes for quick recycling.
Here's an idea for how we might implement this:
Each unbounded channel keeps a lock-free stack of removed nodes.
If a receive operation removes a node, we should push it onto the stack. However, if the stack is larger than the live queue, that means we're wasting a lot of memory. In such cases we should deallocate the removed node as well as deallocate one node from the stack.
If a send operation needs a new node, it should first try popping one from the stack. And if the stack is empty, just allocate a fresh node.
The text was updated successfully, but these errors were encountered: