MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / ConstructRandomVector

Function ConstructRandomVector

deps/google-benchmark/test/complexity_test.cc:110–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108// ========================================================================= //
109
110std::vector<int> ConstructRandomVector(int64_t size) {
111 std::vector<int> v;
112 v.reserve(static_cast<size_t>(size));
113 for (int i = 0; i < size; ++i) {
114 v.push_back(static_cast<int>(std::rand() % size));
115 }
116 return v;
117}
118
119void BM_Complexity_O_N(benchmark::State &state) {
120 auto v = ConstructRandomVector(state.range(0));

Callers 2

BM_Complexity_O_NFunction · 0.85
BM_Complexity_O_N_log_NFunction · 0.85

Calls 2

reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected