summaryrefslogtreecommitdiffhomepage
path: root/benchmarks/misc/sso_bench.cpp
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-24 20:24:29 +0200
committerTyge Løvset <[email protected]>2022-04-24 20:24:29 +0200
commit8aeec88bd7f15069a388f7fc8fe0008af4d1ab44 (patch)
tree909d8c7cdeb5fc6daad007d4cd46e65d4af1c6e4 /benchmarks/misc/sso_bench.cpp
parent6d8406e66c029d4c672bb7531aabec7eb1d079d8 (diff)
downloadSTC-modified-8aeec88bd7f15069a388f7fc8fe0008af4d1ab44.tar.gz
STC-modified-8aeec88bd7f15069a388f7fc8fe0008af4d1ab44.zip
Fixed unfair comparison; std::move must be used in c++ push_back(). STC has almost identical performance to c++ STL, but STC cstr has 23 chars short strings vs typically 15 for c++ std::string, so STC is faster in this range.
Diffstat (limited to 'benchmarks/misc/sso_bench.cpp')
-rw-r--r--benchmarks/misc/sso_bench.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/benchmarks/misc/sso_bench.cpp b/benchmarks/misc/sso_bench.cpp
index 08444320..5ff54be9 100644
--- a/benchmarks/misc/sso_bench.cpp
+++ b/benchmarks/misc/sso_bench.cpp
@@ -32,7 +32,7 @@ static void sromutrio(uint64_t seed) {
static const char CHARS[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=+-";
static const int BENCHMARK_SIZE = 5000000;
-static const int MAX_STRING_LENGTH = 25;
+static const int MAX_STRING_LENGTH = 30;
using time_point = std::chrono::high_resolution_clock::time_point;
@@ -43,7 +43,7 @@ void addRandomString_STD(std::vector<std::string>& vec, const int length) {
p[i] = CHARS[romutrio() & 63];
}
s.append(s);
- vec.push_back(s);
+ vec.push_back(std::move(s));
}
void addRandomString_STC(svec& vec, const int length) {