Top all-time · #9677
lo.calho.st
Personal blog · lo.calho.stprogrammingsystemsdata
lo.calho.st is a personal blog at lo.calho.st about programming, systems and data. Since 2017, 8 different Hacker News readers have linked it 9 times, most often “Using black magic to make a fast circular buffer (2017)”. It is still writing: the last post was on 2026-08-13, and you can follow it by feed.
Too few sampled comments (1) to say how often HN recommends it.?
Why HN links it
Linked as an example of a post on the mmap 'black magic' ring buffer trick, which lets a pointer span the wraparound point as one contiguous chunk. The post is cited in a discussion of ring buffers versus std::deque.
Summarised by Claude from a sample of 1 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
Most-linked posts?
- Using black magic to make a fast circular buffer (2017)6 people · 6 mentions · first linked 2021-06-13
What Hacker News says?
I've seen this trick used around, where it really shines is when you want to prepare/commit a range of the ring buffer when interfacing with something that wants a contiguous chunk as an arg, using the mmap hack lets you pass any pointer into the ring buffer without needing to split it to handle the wraparound case. There are a few blog posts out there about it, eg https://lo.calho.st/posts/black-magic-buffer/ . One…
Comment linking /posts/black-magic-buffer/
on “Shift-to-Middle Array: A Faster Alternative to Std:Deque?”Submitted Using black magic to make a fast circular buffer (2017) as a story · 77 points
HN discussionSubmitted Using black magic to make a fast circular buffer as a story · 6 points
HN discussionSubmitted Using black magic to make a fast circular buffer as a story · 5 points
HN discussionSubmitted An idiot’s guide to fulltext search in PostgreSQL as a story · 4 points
HN discussionSubmitted Using black magic to make a fast circular buffer (2017) as a story · 2 points
HN discussionSubmitted Using black magic to make a fast circular buffer as a story · 2 points
HN discussionSubmitted Using black magic to make a fast circular buffer as a story · 1 points
HN discussionSubmitted A highly customizable RGB controller implementation for Arduino as a story · 1 points
HN discussion