Timing Wheels

(pncnmnp.github.io)

48 points | by pncnmnp 4 days ago

2 comments

  • o11c 6 hours ago
    It's hard for me to take this article seriously when it uses so many words but never once mentions "priority queue", and only mentions "heap" as an (copy-pasted) aside. Most people should use that instead.

    This is a useful data structure for its niche where accuracy doesn't matter and most events will be canceled, but I would not use this article to learn about it.

    This does remind me of some thoughts on what a timer API should look like - there needs to be a distinction between "fire-and-forget so never cancel", "owned but cancellation is rare", "owned and cancellation is common". I've almost exclusively used the first two; for rare cancellations you can rely a lot on amortized constant overhead, or use bubbling, or use precise tracked cancellation.

    ... this is one case when I utilized C++ nontrivial move constructors to their fullest extent, something which Rust chooses to make utterly impossible.

  • omarvanez 8 hours ago
    This looks like a great and useful resource, subscribed to the RSS feed