Menu

📰
0

Reddit - Please wait for verification

C++·/u/Main_Pay_3213·3 days ago
#59wtUPqX
Reading 0:00
15s threshold

Hi, I'm a hobbyist programmer and I recently came across Barry Revzin's blog post about inefficiencies in the C++ ranges library when filter or reverse is mixed into an adaptor chain. I wanted to see if I could do something about it, and after some experimentation I ended up with this library: undercurrent. The core idea is a customization point object uc::advance_while, which descends the iterator hierarchy recursively rather than operating at the top level. This allows algorithms to do their work at the lowest iterator level, avoiding redundant predicate evaluations. I observed a significant speed improvement with an adapter chain like take_while | transform | filter | reverse. On Clang 22 + libc++, I'm seeing roughly 16x speedup over std::ranges. Though MSVC shows a smaller improvement (~2x). Currently supports a minimal set of adaptors and algorithms. GCC is not yet working, likely due to module-related issues. I'd love to hear your feedback, thoughts, or any edge cases I should consider!…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More