Skip to content

Instantly share code, notes, and snippets.

@miyuki
Last active January 1, 2017 19:50
Show Gist options
  • Save miyuki/ef4f4d0c03d29e1a9ab056fad294c523 to your computer and use it in GitHub Desktop.
Save miyuki/ef4f4d0c03d29e1a9ab056fad294c523 to your computer and use it in GitHub Desktop.
ranges-v3 benchmark
int64_t compute(int64_t sz, size_t iter_num)
{
using namespace ranges::v3;
auto res = view::generate([sz]{
auto xs = view::iota(0LL, sz);
auto ys = view::zip_with([](auto x, auto y){ return x+y; },
xs, xs | view::drop(1));
return accumulate(ys | view::stride(100), 0LL);
});
return *(res | view::drop_exactly(iter_num-1)).begin();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment