|
|
|
|
|
by jauntywundrkind
744 days ago
|
|
Yeah, leaving small old buffers behind seems like a major no-no to me. It could be useful if you think you'll shrink back down, but it feels like cache locality suffering and iteration/tracking penalties strongly incentive getting rid of the old buffer asap. One other thing I want to shout out, I saw what I thought was a really neat multicast ring buffer the other day where the author has an atomic for each element, rather than the typical reader/writer atomics. The promise was having much less contention on any given atomic, in most cases. https://github.com/rezabrizi/SPMC-Queue https://news.ycombinator.com/item?id=40410172 |
|
You never know how many concurrent threads still "are" on the place you wish to remove.
You would have to deal with stuff like hazard pointers, limbo lists and the like.
Better to keep the small arrays there.