forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a lower threshold for shrinking the ring buffer
Shrink by 50% when the buffer is < 25% occupied. This provides room for growth after shrinking without having to immediately grow the ring buffer. For example, if we were to shrink by 50% when the buffer was < 50% occupied, adding a new item after shrinking would cause the buffer to grow immediately. If the number of items in the deque oscillates around 50% occupancy we would end up with accidentally quadratic behavior; there would be a high chance that each `put` and `get` operation would cause the ring buffer to be resized.
- Loading branch information
Showing
1 changed file
with
29 additions
and
39 deletions.
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