Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122070155
main_benchmark.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 15, 14:42
Size
1 KB
Mime Type
text/x-c++
Expires
Thu, Jul 17, 14:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27430373
Attached To
R12667 gbench-stream
main_benchmark.cpp
View Options
/* -------------------------------------------------------------------------- */
#include <aka_iterators.hh>
/* -------------------------------------------------------------------------- */
#include <algorithm>
#include <benchmark/benchmark.h>
#include <vector>
/* -------------------------------------------------------------------------- */
using namespace akantu;
using stream_type = int;
class MyFixture : public benchmark::Fixture {
public:
void SetUp(const ::benchmark::State &state) {
A.resize(state.range(0));
B.resize(state.range(0));
auto view = enumerate(A, B);
std::for_each(view.begin(), view.end(), [](auto &&data) {
std::get<1>(data) = 2. * std::get<0>(data);
std::get<2>(data) = 0.;
});
}
void TearDown(const ::benchmark::State & /*state*/) {}
std::vector<stream_type> A;
std::vector<stream_type> B;
};
BENCHMARK_DEFINE_F(MyFixture, CopyZip)(benchmark::State &st) {
for (auto _ : st) {
auto view = zip(A, B);
benchmark::DoNotOptimize(
std::for_each(view.begin(), view.end(), [](auto &&data) {
std::get<1>(data) = std::get<0>(data);
}));
}
st.SetBytesProcessed(int64_t(st.iterations()) * int64_t(st.range(0)) *
sizeof(stream_type));
}
BENCHMARK_REGISTER_F(MyFixture, CopyZip)->Range(1, 2 << 20);
BENCHMARK_MAIN();
Event Timeline
Log In to Comment