Last active
January 1, 2017 19:50
-
-
Save miyuki/ef4f4d0c03d29e1a9ab056fad294c523 to your computer and use it in GitHub Desktop.
ranges-v3 benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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