最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Why does std::views::take_while() do so many function invocations? (even with `cache_latest`) - Stack Overflow

programmeradmin7浏览0评论

I decided to use std::views stuff because of their bound-safety and readability. It looks like std::views::take_while invokes too many function calls and recomputes the same thing over and over again. This looks like a performance nightmare to me.

I thought the new std::views::cache_latest would be a solution, but testing my code with GCC (trunk) and Clang (trunk) showed otherwise.

In the following, std::views::take_while() invokes its lambda 68 times!

发布评论

评论列表(0)

  1. 暂无评论