You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
libcxx
benchmarks
CMakeLists.txt
ContainerBenchmarks.hpp
GenerateInput.hpp
algorithms.bench.cpp
filesystem.bench.cpp
string.bench.cpp
stringstream.bench.cpp
unordered_set_operations.bench.cpp
util_smartptr.bench.cpp
vector_operations.bench.cpp
cmake
docs
fuzzing
include
lib
src
utils
www
.arcconfig
.clang-format
.gitignore
CMakeLists.txt
CREDITS.TXT
LICENSE.TXT
NOTES.TXT
TODO.TXT
appveyor-reqs-install.cmd
appveyor.yml
libcxxabi
libunwind
lld
lldb
llvm
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
![]() |
#include <unordered_set>
|
||
|
#include <vector>
|
||
|
#include <cstdint>
|
||
|
|
||
|
#include "benchmark/benchmark_api.h"
|
||
|
#include "GenerateInput.hpp"
|
||
|
|
||
|
constexpr std::size_t TestNumInputs = 1024;
|
||
|
|
||
|
template <class GenInputs>
|
||
|
void BM_Sort(benchmark::State& st, GenInputs gen) {
|
||
|
using ValueType = typename decltype(gen(0))::value_type;
|
||
|
const auto in = gen(st.range(0));
|
||
|
std::vector<ValueType> inputs[5];
|
||
|
auto reset_inputs = [&]() {
|
||
|
for (auto& C : inputs) {
|
||
|
C = in;
|
||
|
benchmark::DoNotOptimize(C.data());
|
||
|
}
|
||
|
};
|
||
|
reset_inputs();
|
||
|
while (st.KeepRunning()) {
|
||
|
for (auto& I : inputs) {
|
||
|
std::sort(I.data(), I.data() + I.size());
|
||
|
benchmark::DoNotOptimize(I.data());
|
||
|
}
|
||
|
st.PauseTiming();
|
||
|
reset_inputs();
|
||
|
benchmark::ClobberMemory();
|
||
|
st.ResumeTiming();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, random_uint32,
|
||
|
getRandomIntegerInputs<uint32_t>)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, sorted_ascending_uint32,
|
||
|
getSortedIntegerInputs<uint32_t>)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, sorted_descending_uint32,
|
||
|
getReverseSortedIntegerInputs<uint32_t>)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, single_element_uint32,
|
||
|
getDuplicateIntegerInputs<uint32_t>)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, pipe_organ_uint32,
|
||
|
getPipeOrganIntegerInputs<uint32_t>)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, random_strings,
|
||
|
getRandomStringInputs)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, sorted_ascending_strings,
|
||
|
getSortedStringInputs)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, sorted_descending_strings,
|
||
|
getReverseSortedStringInputs)->Arg(TestNumInputs);
|
||
|
|
||
|
BENCHMARK_CAPTURE(BM_Sort, single_element_strings,
|
||
|
getDuplicateStringInputs)->Arg(TestNumInputs);
|
||
|
|
||
|
|
||
|
BENCHMARK_MAIN()
|