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.…