Skip to content

Commit ee73896

Browse files
committed
1.6.7
Optimized copying of short lstrings. The Emscripten build now allows benchmarks to run synchronously. Оптимизировано копирование коротких lstring. В Emscripten сборке добавлена возможность запустить бенчмарки синхронно.
1 parent e62493a commit ee73896

21 files changed

Lines changed: 5164 additions & 5138 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include(FetchContent)
55

66
project(
77
simstr
8-
VERSION 1.6.6
8+
VERSION 1.6.7
99
DESCRIPTION "Yet another modern C++ string library"
1010
HOMEPAGE_URL "https://github.com/orefkov/simstr"
1111
LANGUAGES CXX

bench/bench_str.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* ver. 1.6.6
2+
* ver. 1.6.7
33
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
44
* Бенчмарки
55
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
@@ -19,10 +19,13 @@ using namespace std::literals;
1919

2020
#ifdef EMSCRIPTEN
2121
#include <emscripten.h>
22+
bool do_sync = false;
2223
static void DoTeardown(const benchmark::State& state) {
2324
// Это нужно чтобы интерфейс браузера обновился
2425
// This is necessary for the browser interface to refresh.
25-
emscripten_sleep(1);
26+
if (!do_sync) {
27+
emscripten_sleep(1);
28+
}
2629
}
2730
#undef BENCHMARK
2831
#define BENCHMARK(...) \
@@ -2466,6 +2469,10 @@ int main(int argc, char** argv) {
24662469

24672470
#ifdef EMSCRIPTEN
24682471
EM_ASM({ console.log(navigator.userAgent); });
2472+
if (argc == 2 && stra{argv[1]} == "-sync") {
2473+
do_sync = true;
2474+
argc = 1;
2475+
}
24692476
#endif
24702477

24712478
char arg1[] = "--benchmark_repetitions=4", arg2[] = "--benchmark_report_aggregates_only=true";

bench/comments.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ However, Windows and Linux are clearly in different weight classes.
147147
- std::string copy{str_with_len_N};/16
148148
Явно виден скачок, где заканчивается SSO и начинается аллокация.
149149
Обратите внимание, что WASM - 32-битный, и там размер
150-
SSO у std::string меньше, насколько я помню, 11 символов + 0.
150+
SSO у std::string меньше, 10 символов + 0.
151151
The jump where SSO ends and allocation begins is clearly visible.
152152
Note that WASM is 32-bit, and the size of the SSO for std::string is
153153
smaller, as far as I remember: 11 characters + 0.

bench/emscripten/shell_minimal.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185

186186
<body>
187187
<div class="head">
188-
<h3>SimStr 1.6.6 Benchmark</h3>
188+
<h3>SimStr 1.6.7 Benchmark</h3>
189189
<span><a href="https://orefkov.github.io/simstr/results.html" target="blank">All results</a></span>
190190
<span><a href="https://github.com/orefkov/simstr/blob/main/bench/bench_str.cpp" target="blank">Sources for
191191
benchmarks</a></span>
@@ -199,25 +199,28 @@ <h3>SimStr 1.6.6 Benchmark</h3>
199199
var Module = {
200200
print(...args) {
201201
console.log(...args);
202-
var text = args.join(' ')
203202
try {
204-
if (text.match(/^--+[^-]/)) {
205-
add_benchset(text.match(/^-+ +(.+?) +-+\/repeats/)[1]);
203+
var text = args.join(' ')
204+
var m = text.match(/^--+ +(.+?) +-+\/repeats/);
205+
if (m) {
206+
add_benchset(m[1]);
206207
} else {
207208
var im = text.indexOf("_mean ");
208209
if (im != -1) {
209210
add_benchmark(text.substr(0, im), text.match(/ ([^ ]+?) ns/)[1]);
210211
}
211212
}
212-
} catch (e) {
213-
console.error(e);
214-
}
215-
if (outputElement) {
216213
outputElement.value += text + "\n";
217214
outputElement.scrollTop = outputElement.scrollHeight;
215+
} catch (e) {
216+
console.error(e);
218217
}
219218
}
220219
};
220+
var sync = new URLSearchParams(window.location.search).get('sync');
221+
if (sync)
222+
Module.arguments = ["-sync"];
223+
221224
function on_done() {
222225
resultEl.scrollTop = 0;
223226
}

bench/results.html

Lines changed: 672 additions & 672 deletions
Large diffs are not rendered by default.

bench/results/000-Xeon E5-2682 v4, Ubuntu 22 (WSL), Clang-21.txt

Lines changed: 875 additions & 875 deletions
Large diffs are not rendered by default.

bench/results/001-Xeon E5-2682 v4, Ubuntu 22 (WSL), GCC-13.txt

Lines changed: 885 additions & 885 deletions
Large diffs are not rendered by default.

bench/results/002-Xeon E5-2682 v4, Windows 10, Clang-19.txt

Lines changed: 894 additions & 894 deletions
Large diffs are not rendered by default.

bench/results/003-Xeon E5-2682 v4, Windows 10, MSVC-19.txt

Lines changed: 893 additions & 893 deletions
Large diffs are not rendered by default.

bench/results/004-Xeon E5-2682 v4, WASM Chrome 143, Clang-21.txt

Lines changed: 878 additions & 878 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)