For comparison: pure copy with type conversion.
| 66 | |
| 67 | // For comparison: pure copy with type conversion. |
| 68 | void std_copy_converting(benchmark::State& state) { |
| 69 | auto source = generate_junk<int32_t>(kSize); |
| 70 | // bigger type to avoid warnings |
| 71 | std::vector<int64_t> target(kSize); |
| 72 | |
| 73 | for (auto _ : state) { |
| 74 | std::copy(source.begin(), source.end(), target.begin()); |
| 75 | } |
| 76 | state.SetItemsProcessed(state.iterations() * kSize); |
| 77 | } |
| 78 | |
| 79 | BENCHMARK(std_copy_converting); |
| 80 |