r/cpp • u/Little-Reflection986 • Feb 16 '26
Favorite optimizations ??
I'd love to hear stories about people's best feats of optimization, or something small you are able to use often!
135
Upvotes
View all comments
Show parent comment
1
u/CocktailPerson Feb 17 '26
My favorite version of this a "broadcast" or "multicast" queue, where the writer is actually allowed to lap readers that fall too far behind. It's only useful if your readers can recover from losing some data in the queue (or don't care about it), but it does mean that the writer never has to wait for a reader, and it means there can be an arbitrary number of readers attached to the queue.