blob: 21cadab12abebe130885d68e50a7554f05f75ff5 [file] [edit]
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
#include <iterator>
#include <fstream>
#include <vector>
#include <benchmark/benchmark.h>
static void bm_copy(benchmark::State& state) {
std::vector<char> buffer;
buffer.resize(16384);
std::ofstream stream("/dev/null");
for (auto _ : state)
std::copy(buffer.begin(), buffer.end(), std::ostreambuf_iterator<char>(stream.rdbuf()));
}
BENCHMARK(bm_copy)->Name("std::copy(CharT*, CharT*, ostreambuf_iterator)");
BENCHMARK_MAIN();