mirror of https://github.com/orefkov/simstr.git
Compare commits
17 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
e9eaa6c4cb | |
|
|
00a4a008a9 | |
|
|
86deccbac3 | |
|
|
a779aa7320 | |
|
|
e9e717c8bd | |
|
|
0861d365f5 | |
|
|
91a2f798e3 | |
|
|
c8fb92fee0 | |
|
|
a083ff1b8b | |
|
|
f798e8fbbb | |
|
|
75c9d52f0d | |
|
|
c604e89bdf | |
|
|
7bb7ddb766 | |
|
|
8610bea2a9 | |
|
|
ee73896337 | |
|
|
e62493a678 | |
|
|
8cf026f2c6 |
|
|
@ -5,7 +5,7 @@ include(FetchContent)
|
|||
|
||||
project(
|
||||
simstr
|
||||
VERSION 1.6.5
|
||||
VERSION 1.9.1
|
||||
DESCRIPTION "Yet another modern C++ string library"
|
||||
HOMEPAGE_URL "https://github.com/orefkov/simstr"
|
||||
LANGUAGES CXX
|
||||
|
|
@ -29,6 +29,12 @@ option(SIMSTR_BUILD_TESTS "Build tests" ON)
|
|||
option(SIMSTR_BENCHMARKS "Build benchmarks" Off)
|
||||
option(USE_SYSTEM_DEPS "Use system dependencies" Off)
|
||||
cmake_dependent_option(SIMSTR_LINK_NATVIS "Link natvis file" On CAN_LINK_NATVIS Off)
|
||||
cmake_dependent_option(SIMSTR_USE_LIBCXX "Use libc++" Off "NOT CAN_LINK_NATVIS" Off)
|
||||
|
||||
if (SIMSTR_USE_LIBCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
|
||||
endif(SIMSTR_USE_LIBCXX)
|
||||
|
||||
add_library(simstr_simstr
|
||||
src/sstring.cpp
|
||||
|
|
@ -125,6 +131,9 @@ if(SIMSTR_BUILD_TESTS)
|
|||
if(TARGET gtest)
|
||||
target_compile_features(gtest PUBLIC cxx_std_23)
|
||||
target_compile_features(gtest_main PUBLIC cxx_std_23)
|
||||
if (CLANG_COMPILER)
|
||||
target_compile_options(gtest PRIVATE -Wno-error=character-conversion)
|
||||
endif(CLANG_COMPILER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -142,6 +151,10 @@ function(GBencmark)
|
|||
set(BENCHMARK_INSTALL_DOCS OFF)
|
||||
set(BENCHMARK_DOWNLOAD_DEPENDENCIES ON)
|
||||
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
|
||||
if (SIMSTR_USE_LIBCXX)
|
||||
set(BENCHMARK_USE_LIBCXX On)
|
||||
endif(SIMSTR_USE_LIBCXX)
|
||||
|
||||
add_compile_definitions(BENCHMARK_STATIC_DEFINE)
|
||||
FetchContent_MakeAvailable(googlebench)
|
||||
if(TARGET benchmark)
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@
|
|||
"inherits": "base",
|
||||
"displayName": "Linux base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "gcc-13",
|
||||
"CMAKE_CXX_COMPILER": "g++-13",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": true
|
||||
},
|
||||
"condition": {
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
},
|
||||
{
|
||||
"name": "linux-release",
|
||||
"displayName": "Linux Release",
|
||||
"displayName": "Linux Release GCC",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
|
|
@ -181,8 +181,20 @@
|
|||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "clang-21",
|
||||
"CMAKE_CXX_COMPILER": "clang++-21"
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-release-clang-libcxx",
|
||||
"displayName": "Linux Release Clang libc++",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"SIMSTR_USE_LIBCXX": true,
|
||||
"SIMSTR_BENCHMARKS": true
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -6,7 +6,12 @@ cmake_minimum_required (VERSION 3.15)
|
|||
add_executable(benchStr bench_str.cpp bench.h)
|
||||
target_link_libraries(benchStr simstr::simstr benchmark::benchmark)
|
||||
target_compile_features(benchStr PUBLIC cxx_std_23)
|
||||
target_compile_definitions(benchStr PRIVATE SIMSTR_VERSION="${PROJECT_VERSION}")
|
||||
target_compile_definitions(benchStr PRIVATE
|
||||
SIMSTR_VERSION="${PROJECT_VERSION}"
|
||||
CXX_COMPILER_ID="${CMAKE_CXX_COMPILER_ID}"
|
||||
CXX_COMPILER_VERSION="${CMAKE_CXX_COMPILER_VERSION}"
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
fmt
|
||||
GIT_REPOSITORY https://github.com/fmtlib/fmt
|
||||
|
|
@ -14,7 +19,14 @@ FetchContent_Declare(
|
|||
)
|
||||
FetchContent_MakeAvailable(fmt)
|
||||
|
||||
target_link_libraries(benchStr fmt::fmt)
|
||||
FetchContent_Declare(
|
||||
stringzilla
|
||||
GIT_REPOSITORY https://github.com/ashvardanian/StringZilla.git
|
||||
GIT_TAG main # or specify a version tag
|
||||
)
|
||||
FetchContent_MakeAvailable(stringzilla)
|
||||
|
||||
target_link_libraries(benchStr fmt::fmt stringzilla_header)
|
||||
|
||||
add_executable(process_result process_result.cpp)
|
||||
target_link_libraries(process_result simstr_simstr)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
/*
|
||||
* ver. 1.6.5
|
||||
* ver. 1.9.1
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Бенчмарки
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
* Benchmarks
|
||||
*/
|
||||
#include <stringzilla/stringzilla.h>
|
||||
#include <stringzilla/stringzilla.hpp>
|
||||
|
||||
#include "bench.h"
|
||||
#include <sstream>
|
||||
|
|
@ -14,16 +16,18 @@
|
|||
#include <fmt/format.h>
|
||||
#include <fmt/compile.h>
|
||||
|
||||
using namespace simstr;
|
||||
using namespace std::literals;
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
bool do_sync = false;
|
||||
static void DoTeardown(const benchmark::State& state) {
|
||||
// Это нужно чтобы интерфейс браузера обновился
|
||||
// This is necessary for the browser interface to refresh.
|
||||
if (!do_sync) {
|
||||
emscripten_sleep(1);
|
||||
}
|
||||
static void DoSetup(const benchmark::State& state) {
|
||||
EM_ASM({
|
||||
on_begin_benchmark(UTF8ToString($0));
|
||||
}, state.name().c_str());
|
||||
emscripten_sleep(1);
|
||||
}
|
||||
#undef BENCHMARK
|
||||
#define BENCHMARK(...) \
|
||||
|
|
@ -31,19 +35,148 @@ static void DoSetup(const benchmark::State& state) {
|
|||
(::benchmark::internal::RegisterBenchmarkInternal( \
|
||||
::benchmark::internal::make_unique< \
|
||||
::benchmark::internal::FunctionBenchmark>(#__VA_ARGS__, \
|
||||
__VA_ARGS__)))->Setup(DoSetup)->Teardown(DoTeardown)
|
||||
#endif
|
||||
__VA_ARGS__)))->Teardown(DoTeardown)
|
||||
|
||||
using namespace simstr;
|
||||
using namespace std::literals;
|
||||
#undef BENCHMARK_CAPTURE
|
||||
#define BENCHMARK_CAPTURE(func, test_case_name, ...) \
|
||||
BENCHMARK_PRIVATE_DECLARE(_benchmark_) = \
|
||||
(::benchmark::internal::RegisterBenchmarkInternal( \
|
||||
::benchmark::internal::make_unique< \
|
||||
::benchmark::internal::FunctionBenchmark>( \
|
||||
#func "/" #test_case_name, \
|
||||
[](::benchmark::State& st) { func(st, __VA_ARGS__); })))->Teardown(DoTeardown)
|
||||
|
||||
#endif
|
||||
|
||||
#define TEST_TEXT "Test text"
|
||||
#define LONG_TEXT "123456789012345678901234567890"
|
||||
#define TEXT_16 "abbaabbaabbaabba"
|
||||
|
||||
#define CHECK_RESULT
|
||||
//#define CHECK_RESULT
|
||||
|
||||
void __(benchmark::State& state) { for (auto _: state) {} }
|
||||
namespace sz = ashvardanian::stringzilla;
|
||||
|
||||
sz::string email_concat_stringzilla_app(sz::string name, sz::string_view domain, sz::string_view tld) {
|
||||
return name.append("@").append(domain).append(".").append(tld);
|
||||
}
|
||||
|
||||
//> sz::string email_concat_stringzilla_app(sz::string name, sz::string_view domain, sz::string_view tld) {
|
||||
void ConcatEmailSzApp(benchmark::State& state) {
|
||||
sz::string name = "username";
|
||||
sz::string_view domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_stringzilla_app(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
sz::string email_concat_stringzilla_exp(sz::string name, sz::string_view domain, sz::string_view tld) {
|
||||
return sz::string{name | sz::string_view{"@"} | domain | sz::string_view{"."} | tld};
|
||||
}
|
||||
|
||||
//> sz::string email_concat_stringzilla_exp(sz::string name, sz::string_view domain, sz::string_view tld) {
|
||||
void ConcatEmailSzExp(benchmark::State& state) {
|
||||
sz::string name = "username";
|
||||
sz::string_view domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_stringzilla_exp(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
std::string email_concat_format(std::string_view name, std::string_view domain, std::string_view tld) {
|
||||
return std::format("{}@{}.{}", name, domain, tld);
|
||||
}
|
||||
//> std::string email_concat_format(std::string_view name, std::string_view domain, std::string_view tld) {
|
||||
void ConcatEmailFormat(benchmark::State& state) {
|
||||
std::string_view name = "username", domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_format(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
std::string email_concat_stream(std::string_view name, std::string_view domain, std::string_view tld) {
|
||||
std::stringstream s;
|
||||
s << name << "@" << domain << "." << tld;
|
||||
return s.str();
|
||||
}
|
||||
//> std::string email_concat_stream(std::string_view name, std::string_view domain, std::string_view tld) {
|
||||
void ConcatEmailStream(benchmark::State& state) {
|
||||
std::string_view name = "username", domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_stream(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
std::string email_concat_std(std::string name, std::string_view domain, std::string_view tld) {
|
||||
return name.append("@").append(domain).append(".").append(tld);
|
||||
}
|
||||
//> std::string email_concat_std(std::string name, std::string_view domain, std::string_view tld) {
|
||||
void ConcatEmailStd(benchmark::State& state) {
|
||||
std::string name = "username";
|
||||
std::string_view domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_std(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
std::string email_concat_std_expr(std::string_view name, std::string_view domain, std::string_view tld) {
|
||||
return +name + "@" + domain + "." + tld;
|
||||
}
|
||||
//> std::string email_concat_std_expr(std::string_view name, std::string_view domain, std::string_view tld) {
|
||||
void ConcatEmailStdExp(benchmark::State& state) {
|
||||
std::string_view name = "username", domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_std_expr(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
stringa email_concat_sim_expr(ssa name, ssa domain, ssa tld) {
|
||||
return name + "@" + domain + "." + tld;
|
||||
}
|
||||
//> stringa email_concat_sim_expr(ssa name, ssa domain, ssa tld) {
|
||||
void ConcatEmailSimExp(benchmark::State& state) {
|
||||
ssa name = "username", domain = "verybigdomain", tld = "tld";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(name);
|
||||
benchmark::DoNotOptimize(domain);
|
||||
benchmark::DoNotOptimize(tld);
|
||||
auto email = email_concat_sim_expr(name, domain, tld);
|
||||
benchmark::DoNotOptimize(email);
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(__)->Name("----- Concatenate email ---------")->Repetitions(1);
|
||||
BENCHMARK(ConcatEmailFormat)->Name("Concat email std::format");
|
||||
BENCHMARK(ConcatEmailStream)->Name("Concat email std::stringstream");
|
||||
BENCHMARK(ConcatEmailSzApp) ->Name("Concat email stringzilla append");
|
||||
BENCHMARK(ConcatEmailSzExp) ->Name("Concat email stringzilla concat");
|
||||
BENCHMARK(ConcatEmailStd) ->Name("Concat email std::string append");
|
||||
BENCHMARK(ConcatEmailStdExp)->Name("Concat email std::string by strexpr");
|
||||
BENCHMARK(ConcatEmailSimExp)->Name("Concat email stringa");
|
||||
|
||||
void ConcatStdToStd(benchmark::State& state) {
|
||||
std::string s1 = "start ";
|
||||
|
|
@ -285,6 +418,20 @@ void FmtFormat(benchmark::State& state) {
|
|||
|
||||
}
|
||||
|
||||
void StdFormatSize(benchmark::State& state) {
|
||||
for (auto _: state) {
|
||||
for (unsigned i = 1; i <= 100'000; i *= 10) {
|
||||
size_t len = std::formatted_size("abcdefghihklmopqr {:#010o} end", i);
|
||||
std::string str;
|
||||
str.resize_and_overwrite(len, [&](char* p, size_t) {
|
||||
std::format_to_n(str.data(), len, "abcdefghihklmopqr {:#010o} end", i);
|
||||
return len;
|
||||
});
|
||||
benchmark::DoNotOptimize(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(__)->Name("---- format/vformat and subst/vsubst octal number to 32 symbols result ----")->Repetitions(1);
|
||||
BENCHMARK(ConcatSimToSimOct) ->Name("\"abcdefghihklmopqr \"_ss + i / 0x8a010_fmt + \" end\"");
|
||||
BENCHMARK(SubstSimToSimOct) ->Name("e_subst(\"abcdefghihklmopqr {} end\", i / 0x8a010_fmt)");
|
||||
|
|
@ -293,6 +440,7 @@ BENCHMARK(FmtFormatComp) ->Name("fmt::format(FMT_COMPILE(\"abcdefghihklmo
|
|||
BENCHMARK(FmtFormat) ->Name("fmt::format(\"abcdefghihklmopqr {:#010o} end\", i)");
|
||||
BENCHMARK(FormatStdToStdOct) ->Name("std::format(\"abcdefghihklmopqr {:#010o} end\", i)");
|
||||
BENCHMARK(VFormatStdToStdOct) ->Name("std::vformat(pattern, std::make_format_args(i))");
|
||||
BENCHMARK(StdFormatSize) ->Name("std::format with std::formatted_size");
|
||||
BENCHMARK(StreamStdToStdOct) ->Name("strm << \"abcdefghihklmopqr 0\" << std::oct << std::setw(9) << std::setfill('0') << i << \" end\"");
|
||||
|
||||
void ConcatStdToStdS(benchmark::State& state) {
|
||||
|
|
@ -346,6 +494,10 @@ size_t find_pos_sim(ssa src, ssa name) {
|
|||
return src.find(lstringa<200>{"\n- " + name + " -\n"});
|
||||
}
|
||||
|
||||
size_t find_pos_sz(sz::string_view src, sz::string_view name) {
|
||||
return src.find(sz::string{"\n- "}.append(name).append(" -\n"));
|
||||
}
|
||||
|
||||
//> size_t find_pos_str(std::string_view src, std::string_view name) {
|
||||
void FindConcatThreeStr(benchmark::State& state) {
|
||||
std::string_view src = "sdfsdf\n- testtesttesttesttesttesttestte -\nsfrgdgfsg";
|
||||
|
|
@ -396,11 +548,27 @@ void FindConcatThreeSim(benchmark::State& state) {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//> size_t find_pos_sz(sz::string_view src, sz::string_view name) {
|
||||
void FindConcatThreeSz(benchmark::State& state) {
|
||||
sz::string_view src = "sdfsdf\n- testtesttesttesttesttesttestte -\nsfrgdgfsg";
|
||||
sz::string_view fnd = "testtesttesttesttesttesttestte";
|
||||
for (auto _: state) {
|
||||
benchmark::DoNotOptimize(src);
|
||||
benchmark::DoNotOptimize(fnd);
|
||||
size_t pos = find_pos_sz(src, fnd);
|
||||
benchmark::DoNotOptimize(pos);
|
||||
#ifdef CHECK_RESULT
|
||||
if (pos != 6) {
|
||||
state.SkipWithError("fail");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
BENCHMARK(__)->Name("----- Find three concatenated string in string_view -----")->Repetitions(1);
|
||||
BENCHMARK(FindConcatThreeStr)->Name("Find concat three std::string");
|
||||
BENCHMARK(FindConcatThreeExp)->Name("Find concat three strexpr");
|
||||
BENCHMARK(FindConcatThreeSim)->Name("Find concat three simstr");
|
||||
BENCHMARK(FindConcatThreeSz) ->Name("Find concat three stringzilla string");
|
||||
|
||||
std::string buildTypeNameStr(std::string_view type_name, size_t prec, size_t scale) {
|
||||
std::string res{type_name};
|
||||
|
|
@ -622,6 +790,7 @@ void Find(benchmark::State& state) {
|
|||
}
|
||||
}
|
||||
BENCHMARK(__)->Name("----- Find 9 symbols text in end of 99 symbols text ---------")->Repetitions(1);
|
||||
BENCHMARK(Find<sz::string>)->Name("sz::string::find;");
|
||||
BENCHMARK(Find<std::string>) ->Name("std::string::find;");
|
||||
BENCHMARK(Find<std::string_view>) ->Name("std::string_view::find;");
|
||||
BENCHMARK(Find<ssa>) ->Name("ssa::find;");
|
||||
|
|
@ -769,7 +938,6 @@ void ToIntNoOverflow(benchmark::State& state, ssa t, int c) {
|
|||
benchmark::DoNotOptimize(t);
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(__)->Name("----- Convert to int '1234567' ---------")->Repetitions(1);
|
||||
BENCHMARK_CAPTURE(ToIntStr10, , std::string{"123456789"}, 123456789) ->Name("std::string s = \"123456789\"; int res = std::strtol(s.c_str(), 0, 10);");
|
||||
BENCHMARK_CAPTURE(ToIntFromChars10, , std::string_view{"123456789"}, 123456789) ->Name("std::string_view s = \"123456789\"; std::from_chars(s.data(), s.data() + s.size(), res, 10);");
|
||||
|
|
@ -804,12 +972,17 @@ void ToDoubleStr(benchmark::State& state, const std::string& s, double c) {
|
|||
}
|
||||
}
|
||||
|
||||
template<typename K = char>
|
||||
void ToDoubleFromChars(benchmark::State& state, const std::string_view& s, double c) {
|
||||
for (auto _: state) {
|
||||
double res = 0;
|
||||
if (std::from_chars(s.data(), s.data() + s.size(), res).ec != std::errc{}) {
|
||||
if constexpr (requires { std::from_chars(std::declval<K*>(), std::declval<K*>(), std::declval<double&>()); }) {
|
||||
if (std::from_chars((const K*)s.data(), (const K*)s.data() + s.size(), res).ec != std::errc{}) {
|
||||
state.SkipWithError("not equal");
|
||||
}
|
||||
} else {
|
||||
state.SkipWithError("not implemented");
|
||||
}
|
||||
#ifdef CHECK_RESULT
|
||||
if (res != c) {
|
||||
state.SkipWithError("not equal");
|
||||
|
|
@ -1803,7 +1976,7 @@ void ReplaceAllLongerSimStringExpr(benchmark::State& state) {
|
|||
lstringa<2048> big_source{Count, source}, big_sample{Count, sample};
|
||||
|
||||
for (auto _: state) {
|
||||
stringa result = e_repl(big_source.to_str(), "bb", "----");
|
||||
stringa result = e_repl(big_source, "bb", "----");
|
||||
|
||||
#ifdef CHECK_RESULT
|
||||
if (result.to_str() != big_sample) {
|
||||
|
|
@ -2454,13 +2627,62 @@ BENCHMARK(BuildFuncNameStream) ->Name("Build func full name std::stream;
|
|||
BENCHMARK(BuildFuncNameSimStr) ->Name("Build func full name stringa;");
|
||||
BENCHMARK(BuildFuncNameSimStr1) ->Name("Build func full name stringa 1;");
|
||||
|
||||
void UpperCaseStd(benchmark::State& state) {
|
||||
static const auto& loc = std::locale("en_US.utf8");
|
||||
|
||||
for (auto _: state) {
|
||||
std::wstring test = L"TestПриветTest";
|
||||
benchmark::DoNotOptimize(test);
|
||||
|
||||
std::transform(test.begin(), test.end(), test.begin(), [](wchar_t s) {
|
||||
return std::toupper(s, loc);
|
||||
});
|
||||
|
||||
benchmark::DoNotOptimize(test);
|
||||
#ifdef CHECK_RESULT
|
||||
if (test != L"TESTПРИВЕТTEST") {
|
||||
state.SkipWithError("Bad upper case");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void UpperCaseSim(benchmark::State& state) {
|
||||
for (auto _: state) {
|
||||
lstringw<15> test = L"TestПриветTest";
|
||||
benchmark::DoNotOptimize(test);
|
||||
|
||||
test.upper();
|
||||
|
||||
benchmark::DoNotOptimize(test);
|
||||
#ifdef CHECK_RESULT
|
||||
if (test != L"TESTПРИВЕТTEST") {
|
||||
state.SkipWithError("Bad upper case");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(__)->Name("----- Make Upper ---------")->Repetitions(1);
|
||||
BENCHMARK(UpperCaseStd)->Name("To upper case std::wstring");
|
||||
BENCHMARK(UpperCaseSim)->Name("To upper case lstringw<15>");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::cout << "Benchmarks of simstr, version " SIMSTR_VERSION << "\n"
|
||||
<< "Sources: https://github.com/orefkov/simstr\n"
|
||||
<< "Results: https://orefkov.github.io/simstr/results.html\n" << std::endl;
|
||||
<< "Results: https://orefkov.github.io/simstr/results.html\n"
|
||||
<< "Compiler " << CXX_COMPILER_ID << " " << CXX_COMPILER_VERSION
|
||||
#ifdef _LIBCPP_VERSION
|
||||
<< ", use libc++"
|
||||
#endif
|
||||
<< std::endl;
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
EM_ASM({ console.log(navigator.userAgent); });
|
||||
if (argc == 2 && stra{argv[1]} == "-sync") {
|
||||
do_sync = true;
|
||||
argc = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
char arg1[] = "--benchmark_repetitions=4", arg2[] = "--benchmark_report_aggregates_only=true";
|
||||
|
|
@ -2475,7 +2697,9 @@ int main(int argc, char** argv) {
|
|||
::benchmark::RunSpecifiedBenchmarks();
|
||||
::benchmark::Shutdown();
|
||||
#ifdef EMSCRIPTEN
|
||||
std::cout << "Done!\n";
|
||||
EM_ASM({ on_done(); });
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,22 @@ holds 23 characters in SSO instead of 15, so
|
|||
at the end of the std::string test, memory has to be allocated,
|
||||
while in stringa , the entire test is included in SSO.
|
||||
|
||||
- Concat email stringzilla concat
|
||||
В stringzilla тоже есть конкатенация строковыми выражениями, но не
|
||||
так удобна и развита, как в simstr.
|
||||
Stringzilla also has concatenation by expression templates,
|
||||
but it's not as convenient or advanced as simstr.
|
||||
|
||||
- Find concat three simstr
|
||||
Если результат конкатенации меньше 207 символов,
|
||||
он собирается в буфере на стеке, без аллокации и деалокации.
|
||||
If the concatenation result is less than 207 characters,
|
||||
it is collected in a stack-based buffer, without allocation or deallocation.
|
||||
|
||||
- sz::string::find;
|
||||
stringzilla более заточена на поиск больших строк в больших строках.
|
||||
stringzilla is more focused on searching large strings within large strings.
|
||||
|
||||
- Concat with replace exp
|
||||
В simstr строковое выражение для замены подстрок
|
||||
есть "из коробки".
|
||||
|
|
@ -147,7 +157,7 @@ However, Windows and Linux are clearly in different weight classes.
|
|||
- std::string copy{str_with_len_N};/16
|
||||
Явно виден скачок, где заканчивается SSO и начинается аллокация.
|
||||
Обратите внимание, что WASM - 32-битный, и там размер
|
||||
SSO у std::string меньше, насколько я помню, 11 символов + 0.
|
||||
SSO у std::string меньше, 10 символов + 0.
|
||||
The jump where SSO ends and allocation begins is clearly visible.
|
||||
Note that WASM is 32-bit, and the size of the SSO for std::string is
|
||||
smaller, as far as I remember: 11 characters + 0.
|
||||
|
|
|
|||
|
|
@ -1,20 +1,154 @@
|
|||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>SimStr Bencjmarks</title>
|
||||
<title>SimStr Benchmarks</title>
|
||||
<style>
|
||||
body {
|
||||
color: white;
|
||||
background-color: black;
|
||||
margin: auto;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px black;
|
||||
text-align: right;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
table tr:nth-child(odd) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
table tr:nth-child(even) {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
table th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tooltip a:any-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.tooltip a:link {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.tooltip a:visited {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.tooltip a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table tr:hover td {
|
||||
background-color: lightcyan;
|
||||
}
|
||||
|
||||
div.header {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
canvas {
|
||||
max-width: 2000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.benchset {
|
||||
max-width: 960px;
|
||||
padding: 1px;
|
||||
margin: 5px auto;
|
||||
border-radius: 3px;
|
||||
background-color: gainsboro;
|
||||
}
|
||||
|
||||
.benchset h4 {
|
||||
text-align: left;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.test_platforms {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.test_platforms ul {
|
||||
display: table;
|
||||
}
|
||||
|
||||
.test_platforms li {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.test_platforms li:before {
|
||||
content: "\2022";
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
.test_platforms span.tooltip {
|
||||
padding-left: 20px;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
span.platform {
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
.info {
|
||||
border-radius: 3px;
|
||||
border: solid 1px lightgrey;
|
||||
background-color: beige;
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.code {
|
||||
font-family: 'Cascadia Code', Consolas, 'Courier New', Courier, monospace;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext {
|
||||
visibility: hidden;
|
||||
background-color: beige;
|
||||
color: black;
|
||||
text-align: left;
|
||||
border-radius: 6px;
|
||||
padding: 15px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 35px;
|
||||
right: 0;
|
||||
white-space: pre;
|
||||
border: 1px solid darkgray;
|
||||
box-shadow: 4px 4px 8px 0px rgba(34, 60, 80, 0.2);
|
||||
transform: translate(50%);
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
h4 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#output {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 80px;
|
||||
top: 50px;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
bottom: 60%;
|
||||
margin: 0 auto;
|
||||
border: 0;
|
||||
display: block;
|
||||
|
|
@ -23,74 +157,91 @@
|
|||
font-family: 'Cascadia Code', 'Consolas', 'Lucida Console', Monaco, monospace;
|
||||
outline: none;
|
||||
}
|
||||
.ctr {
|
||||
|
||||
#results {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 42%;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
margin: 0 auto;
|
||||
border: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.head {
|
||||
text-align: center;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
div.head h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.head span {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="ctr" id="bs_name"></div><div class="ctr" id="b_name"></div>
|
||||
<textarea class="emscripten" id="output" rows="20"></textarea>
|
||||
<div class="head">
|
||||
<h3>SimStr 1.8.1 Benchmark</h3>
|
||||
<span><a href="https://orefkov.github.io/simstr/results.html" target="blank">All results</a></span>
|
||||
<span><a href="https://github.com/orefkov/simstr/blob/main/bench/bench_str.cpp" target="blank">Sources for
|
||||
benchmarks</a></span>
|
||||
<textarea id="output"></textarea>
|
||||
</div>
|
||||
<div id="results"></div>
|
||||
<script type='text/javascript'>
|
||||
var outputElement = document.getElementById('output');
|
||||
var bsNameEl= document.getElementById('bs_name');
|
||||
var bNameEl= document.getElementById('b_name');
|
||||
var resultEl = document.getElementById('results');
|
||||
if (outputElement) outputElement.value = ''; // clear browser cache
|
||||
var Module = {
|
||||
print(...args) {
|
||||
console.log(...args);
|
||||
if (outputElement) {
|
||||
var text = args.join(' ').replace('_mean', ' ');
|
||||
var rpt = text.indexOf("/repeats");
|
||||
if (rpt != -1)
|
||||
text = text.substr(0, rpt);
|
||||
if (text.indexOf('_median ') == -1 && text.indexOf('_stddev ') == -1 && text.indexOf('_cv ') == -1) {
|
||||
outputElement.value += text + "\n";
|
||||
outputElement.scrollTop = outputElement.scrollHeight; // focus on bottom
|
||||
}
|
||||
}
|
||||
},
|
||||
setStatus(text) {
|
||||
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
|
||||
if (text === Module.setStatus.last.text) return;
|
||||
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
|
||||
var now = Date.now();
|
||||
if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
|
||||
Module.setStatus.last.time = now;
|
||||
Module.setStatus.last.text = text;
|
||||
try {
|
||||
var text = args.join(' ')
|
||||
var m = text.match(/^--+ +(.+?) +-+\/repeats/);
|
||||
if (m) {
|
||||
text = m[1];
|
||||
add_benchset(m[1]);
|
||||
} else {
|
||||
var im = text.indexOf("_mean ");
|
||||
if (im != -1) {
|
||||
add_benchmark(text.substr(0, im), text.match(/ ([^ ]+?) ns/)[1]);
|
||||
}
|
||||
}
|
||||
outputElement.value += text + "\n";
|
||||
outputElement.scrollTop = outputElement.scrollHeight;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
totalDependencies: 0,
|
||||
monitorRunDependencies(left) {
|
||||
this.totalDependencies = Math.max(this.totalDependencies, left);
|
||||
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
|
||||
},
|
||||
};
|
||||
Module.setStatus('Downloading...');
|
||||
window.onerror = () => {
|
||||
Module.setStatus('Exception thrown, see JavaScript console');
|
||||
Module.setStatus = (text) => {
|
||||
if (text) console.error('[post-exception status] ' + text);
|
||||
};
|
||||
};
|
||||
function on_begin_benchmark(name) {
|
||||
if (name.substr(0, 3) == "---") {
|
||||
bsNameEl.innerText = name.match(/^[- ]+(.+?)[ -]+$/)[1];
|
||||
bNameEl.innerText = "";
|
||||
} else {
|
||||
bNameEl.innerText = name;
|
||||
}
|
||||
}
|
||||
function on_done() {
|
||||
bsNameEl.innerText = "Done";
|
||||
bNameEl.innerText = "";
|
||||
}
|
||||
var sync = new URLSearchParams(window.location.search).get('sync');
|
||||
if (sync)
|
||||
Module.arguments = ["-sync"];
|
||||
|
||||
function on_done() {
|
||||
resultEl.scrollTop = 0;
|
||||
}
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
function add_benchset(bs_name) {
|
||||
resultEl.insertAdjacentHTML("beforeend", `<div class="benchset"><h4>${escapeHtml(bs_name)}</h4><table width="100%"><thead><tr><th>Benchmark name</th><th width="8%">Time(ns)</th></tr></thead><tbody></tbody></table></div>`);
|
||||
resultEl.scrollTop = resultEl.scrollHeight;
|
||||
}
|
||||
function add_benchmark(name, result) {
|
||||
resultEl.querySelector("div:last-child table tbody").insertAdjacentHTML("beforeend", `<tr><td>${escapeHtml(name)}</td><td>${result}</td></tr>`);
|
||||
resultEl.scrollTop = resultEl.scrollHeight;
|
||||
}
|
||||
</script>
|
||||
{{{ SCRIPT }}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct result_info {
|
|||
}
|
||||
// Текущее положение поставим сразу за cpuinfo и откинем завершающие переводы строк
|
||||
// We will put the current position immediately after cpuinfo and discard the final line feeds
|
||||
current_text_ = current_text_(cpu_info_.end() - current_text_.begin() + 1).trimmed_right("\n");
|
||||
current_text_ = current_text_.get(cpu_info_.end() - current_text_.begin() + 1, to_end).trimmed_right("\n");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -96,11 +96,11 @@ results_vector get_results_infos() {
|
|||
// В начале имени файла может идти число и дефис, для сортировки, уберём их
|
||||
// At the beginning of the file name there can be a number and a hyphen, for sorting, remove them
|
||||
if (auto delimiter = fileName.find('-'); delimiter + 1 > 1) {
|
||||
if (fileName(0, delimiter).to_int<unsigned, false, 10, false, false>().ec == IntConvertResult::Success) {
|
||||
if (fileName.prefix(delimiter).to_int<unsigned, false, 10, false, false>().ec == IntConvertResult::Success) {
|
||||
fileName.remove_prefix(delimiter + 1);
|
||||
}
|
||||
}
|
||||
results.emplace_back(get_file_content(lstringa<128>{dirForResults + f}), fileName(0, -suffix.length()));
|
||||
results.emplace_back(get_file_content(lstringa<128>{dirForResults + f}), fileName.get(0, from_end(suffix.length())));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
|
@ -117,7 +117,7 @@ void write_platforms_cpu(out_t& out, const results_vector& results) {
|
|||
for (const auto& r : results) {
|
||||
size_t rp = r.cpu_info_.find('(') + 1, lp = r.cpu_info_.find(')', rp);
|
||||
ssa shortCpuInfo = r.cpu_info_.from_to(rp, lp);
|
||||
ssa cpuInfo = r.cpu_info_(lp + 2);
|
||||
ssa cpuInfo = r.cpu_info_.get(lp + 2, to_end);
|
||||
out += e_subst(R"--(
|
||||
<li><span class="platform">{}</span><span class="tooltip">{}<span class="tooltiptext">{}</span></span> Include in charts: <input type="checkbox" id="pl{}" checked onchange="buildCharts()"/></li>)--",
|
||||
r.platform_, shortCpuInfo, cpuInfo, counter++);
|
||||
|
|
@ -167,7 +167,7 @@ ssa extract_name_result(ssa line, ssa& result) {
|
|||
line.len = ns;
|
||||
if (inNs) {
|
||||
size_t end = line.find_last(' ');
|
||||
result = line(end + 1);
|
||||
result = line.get(end + 1, to_end);
|
||||
if (auto rp = line.find("/repeats"); rp != str::npos) {
|
||||
line.len = rp;
|
||||
} else {
|
||||
|
|
@ -182,7 +182,7 @@ ssa extract_name_result(ssa line, ssa& result) {
|
|||
ssa extract_comment(ssa commentsText, ssa benchmarkName) {
|
||||
size_t idx = commentsText.find_end(lstringa<120>{"- " + benchmarkName + "\n"});
|
||||
if (idx != str::npos) {
|
||||
if (commentsText[idx] != '\n' && commentsText(idx, 2) != "- ") {
|
||||
if (commentsText[idx] != '\n' && commentsText.get(idx, 2) != "- ") {
|
||||
return commentsText.from_to(idx, commentsText.find("\n\n", idx));
|
||||
}
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ std::pair<ssa, size_t> extract_source_for_benchmark(ssa benchName, ssa sourceTex
|
|||
}();
|
||||
|
||||
size_t delim = benchName.find_last('/');
|
||||
if (delim != str::npos && benchName(delim + 1).to_int<unsigned, false, 10, false, false>().ec == IntConvertResult::Success) {
|
||||
if (delim != str::npos && benchName.get(delim + 1, to_end).to_int<unsigned, false, 10, false, false>().ec == IntConvertResult::Success) {
|
||||
benchName.len = delim;
|
||||
}
|
||||
auto [it, not_exist] = textes.try_emplace(benchName, stringa{}, 0);
|
||||
|
|
@ -218,7 +218,7 @@ std::pair<ssa, size_t> extract_source_for_benchmark(ssa benchName, ssa sourceTex
|
|||
std::cerr << "Can not found benchmark function name for " << benchName << std::endl;
|
||||
return {stra::empty_str, 0};
|
||||
}
|
||||
start = sourceText(0, start).find('(', sourceText.find_last('\n', start - 1));
|
||||
start = sourceText.prefix(start).find('(', sourceText.find_last('\n', start - 1));
|
||||
if (start == str::npos) {
|
||||
std::cerr << "Can not found benchmark function name for " << benchName << std::endl;
|
||||
return {stra::empty_str, 0};
|
||||
|
|
@ -237,7 +237,7 @@ std::pair<ssa, size_t> extract_source_for_benchmark(ssa benchName, ssa sourceTex
|
|||
}
|
||||
start = sourceText.find_last('\n', start);
|
||||
size_t templ_start = sourceText.find_last('\n', start) + 1;
|
||||
if (sourceText(templ_start).starts_with("template")) {
|
||||
if (sourceText.get(templ_start, to_end).starts_with("template")) {
|
||||
start = templ_start;
|
||||
} else {
|
||||
start++;
|
||||
|
|
@ -261,7 +261,7 @@ std::pair<ssa, size_t> extract_source_for_benchmark(ssa benchName, ssa sourceTex
|
|||
throw std::runtime_error{"Not found end of func"};
|
||||
}
|
||||
lstringa<2048> text{sourceText.from_to(beginLine, end + indent.length() + 1), indent, "\n"};
|
||||
func_it->second.first = repl_html_symbols(text(1));
|
||||
func_it->second.first = repl_html_symbols(text.get(1, to_end));
|
||||
} else {
|
||||
end = sourceText.find("\n}\n", start);
|
||||
func_it->second.first = repl_html_symbols(sourceText.from_to(start, end + 2));
|
||||
|
|
@ -274,7 +274,7 @@ std::pair<ssa, size_t> extract_source_for_benchmark(ssa benchName, ssa sourceTex
|
|||
}
|
||||
|
||||
void write_benchmarks(out_t& out, const results_vector& results, ssa sourceText, ssa commentsText) {
|
||||
ssa releaseVersion = sourceText(sourceText.find_end("\n * ver. ")).until("\n").trimmed();
|
||||
ssa releaseVersion = sourceText.get(sourceText.find_end("\n * ver. "), to_end).until("\n").trimmed();
|
||||
if (!releaseVersion) {
|
||||
std::cerr << "Not found release version in sources" << std::endl;
|
||||
throw std::runtime_error{"Not found release version in sources"};
|
||||
|
|
@ -292,7 +292,7 @@ void write_benchmarks(out_t& out, const results_vector& results, ssa sourceText,
|
|||
while(!splitters[0].is_done()) {
|
||||
ssa line = splitters[0].next(), benchName, result;
|
||||
if (auto rm = line.find("_mean"); rm != str::npos) {
|
||||
benchName = extract_name_result(line, result)(0, rm);
|
||||
benchName = extract_name_result(line, result).prefix(rm);
|
||||
auto [source, line_num] = extract_source_for_benchmark(benchName, sourceText);
|
||||
auto comment = extract_comment(commentsText, benchName);
|
||||
// Нужно вывести название бенча и коммент
|
||||
|
|
@ -312,12 +312,12 @@ void write_benchmarks(out_t& out, const results_vector& results, ssa sourceText,
|
|||
throw std::runtime_error{"Not expected end of file"};
|
||||
}
|
||||
line = splitters[idx].next();
|
||||
ssa rbench_name = extract_name_result(line, result)(0, rm);
|
||||
ssa rbench_name = extract_name_result(line, result).prefix(rm);
|
||||
if (rbench_name != benchName) {
|
||||
while (line.find("_mean") == str::npos && !splitters[idx].is_done()) {
|
||||
line = splitters[idx].next();
|
||||
}
|
||||
rbench_name = extract_name_result(line, result)(0, rm);
|
||||
rbench_name = extract_name_result(line, result).prefix(rm);
|
||||
if (rbench_name != benchName) {
|
||||
std::cerr << "In results for " << results[idx].platform_ << " benchmark '" << rbench_name
|
||||
<< "' does not match with other results" << std::endl;
|
||||
|
|
|
|||
1676
bench/results.html
1676
bench/results.html
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,989 @@
|
|||
Benchmarks of simstr, version 1.8.1
|
||||
Sources: https://github.com/orefkov/simstr
|
||||
Results: https://orefkov.github.io/simstr/results.html
|
||||
Compiler GNU 15.2.0
|
||||
2026-03-22T13:04:50+03:00
|
||||
Running ./benchStr
|
||||
Run on (32 X 2494.22 MHz CPU s)
|
||||
CPU Caches:
|
||||
L1 Data 32 KiB (x16)
|
||||
L1 Instruction 32 KiB (x16)
|
||||
L2 Unified 256 KiB (x16)
|
||||
L3 Unified 40960 KiB (x1)
|
||||
Load Average: 0.06, 0.09, 0.08
|
||||
***WARNING*** ASLR is enabled, the results may have unreproducible noise in them.
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Benchmark Time CPU Iterations
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
----- Concatenate email ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Concat email std::format_mean 160 ns 160 ns 4
|
||||
Concat email std::format_median 162 ns 162 ns 4
|
||||
Concat email std::format_stddev 4.85 ns 4.85 ns 4
|
||||
Concat email std::format_cv 3.03 % 3.03 % 4
|
||||
Concat email std::stringstream_mean 321 ns 321 ns 4
|
||||
Concat email std::stringstream_median 322 ns 322 ns 4
|
||||
Concat email std::stringstream_stddev 3.32 ns 3.32 ns 4
|
||||
Concat email std::stringstream_cv 1.04 % 1.03 % 4
|
||||
Concat email stringzilla append_mean 108 ns 108 ns 4
|
||||
Concat email stringzilla append_median 108 ns 108 ns 4
|
||||
Concat email stringzilla append_stddev 3.84 ns 3.85 ns 4
|
||||
Concat email stringzilla append_cv 3.57 % 3.57 % 4
|
||||
Concat email stringzilla concat_mean 42.8 ns 42.8 ns 4
|
||||
Concat email stringzilla concat_median 42.0 ns 42.0 ns 4
|
||||
Concat email stringzilla concat_stddev 1.96 ns 1.96 ns 4
|
||||
Concat email stringzilla concat_cv 4.57 % 4.57 % 4
|
||||
Concat email std::string append_mean 79.2 ns 79.2 ns 4
|
||||
Concat email std::string append_median 79.1 ns 79.1 ns 4
|
||||
Concat email std::string append_stddev 2.03 ns 2.03 ns 4
|
||||
Concat email std::string append_cv 2.57 % 2.57 % 4
|
||||
Concat email std::string by strexpr_mean 34.4 ns 34.4 ns 4
|
||||
Concat email std::string by strexpr_median 34.7 ns 34.7 ns 4
|
||||
Concat email std::string by strexpr_stddev 0.818 ns 0.818 ns 4
|
||||
Concat email std::string by strexpr_cv 2.38 % 2.38 % 4
|
||||
Concat email stringa_mean 40.7 ns 40.7 ns 4
|
||||
Concat email stringa_median 40.5 ns 40.5 ns 4
|
||||
Concat email stringa_stddev 0.971 ns 0.971 ns 4
|
||||
Concat email stringa_cv 2.38 % 2.38 % 4
|
||||
----- Concatenate string + Number + "Literal" ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Concat std::string and number by std to std::string_mean 214 ns 214 ns 4
|
||||
Concat std::string and number by std to std::string_median 216 ns 216 ns 4
|
||||
Concat std::string and number by std to std::string_stddev 4.91 ns 4.91 ns 4
|
||||
Concat std::string and number by std to std::string_cv 2.30 % 2.30 % 4
|
||||
Concat std::string and number by StrExpr to std::string_mean 102 ns 102 ns 4
|
||||
Concat std::string and number by StrExpr to std::string_median 101 ns 101 ns 4
|
||||
Concat std::string and number by StrExpr to std::string_stddev 2.74 ns 2.74 ns 4
|
||||
Concat std::string and number by StrExpr to std::string_cv 2.69 % 2.69 % 4
|
||||
Concat stringa and number by StrExpr to simstr::stringa_mean 72.3 ns 72.3 ns 4
|
||||
Concat stringa and number by StrExpr to simstr::stringa_median 72.4 ns 72.4 ns 4
|
||||
Concat stringa and number by StrExpr to simstr::stringa_stddev 1.59 ns 1.59 ns 4
|
||||
Concat stringa and number by StrExpr to simstr::stringa_cv 2.21 % 2.21 % 4
|
||||
Concat stringa and number by e_concat to simstr::stringa_mean 77.7 ns 77.7 ns 4
|
||||
Concat stringa and number by e_concat to simstr::stringa_median 77.5 ns 77.5 ns 4
|
||||
Concat stringa and number by e_concat to simstr::stringa_stddev 2.73 ns 2.73 ns 4
|
||||
Concat stringa and number by e_concat to simstr::stringa_cv 3.52 % 3.52 % 4
|
||||
----- Concatenate string + Hex Number + "Literal" ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Concat std::string and format hex number and literal to std::string_mean 728 ns 728 ns 4
|
||||
Concat std::string and format hex number and literal to std::string_median 732 ns 732 ns 4
|
||||
Concat std::string and format hex number and literal to std::string_stddev 19.6 ns 19.6 ns 4
|
||||
Concat std::string and format hex number and literal to std::string_cv 2.68 % 2.68 % 4
|
||||
std::format std::string and hex number by literal to std::string_mean 893 ns 893 ns 4
|
||||
std::format std::string and hex number by literal to std::string_median 890 ns 890 ns 4
|
||||
std::format std::string and hex number by literal to std::string_stddev 22.3 ns 22.3 ns 4
|
||||
std::format std::string and hex number by literal to std::string_cv 2.49 % 2.49 % 4
|
||||
Concat std::string and std::to_chars and string to std::string_mean 199 ns 199 ns 4
|
||||
Concat std::string and std::to_chars and string to std::string_median 199 ns 199 ns 4
|
||||
Concat std::string and std::to_chars and string to std::string_stddev 1.39 ns 1.39 ns 4
|
||||
Concat std::string and std::to_chars and string to std::string_cv 0.70 % 0.70 % 4
|
||||
Concat std::string and hex number and literal by StrExpr to std::string_mean 125 ns 125 ns 4
|
||||
Concat std::string and hex number and literal by StrExpr to std::string_median 126 ns 126 ns 4
|
||||
Concat std::string and hex number and literal by StrExpr to std::string_stddev 1.84 ns 1.84 ns 4
|
||||
Concat std::string and hex number and literal by StrExpr to std::string_cv 1.47 % 1.47 % 4
|
||||
Concat stringa and hex number and literal by StrExpr to simstr::stringa_mean 122 ns 122 ns 4
|
||||
Concat stringa and hex number and literal by StrExpr to simstr::stringa_median 122 ns 122 ns 4
|
||||
Concat stringa and hex number and literal by StrExpr to simstr::stringa_stddev 1.10 ns 1.10 ns 4
|
||||
Concat stringa and hex number and literal by StrExpr to simstr::stringa_cv 0.90 % 0.90 % 4
|
||||
Concat stringa and hex number and literal by e_concat to simstr::stringa_mean 125 ns 125 ns 4
|
||||
Concat stringa and hex number and literal by e_concat to simstr::stringa_median 125 ns 125 ns 4
|
||||
Concat stringa and hex number and literal by e_concat to simstr::stringa_stddev 2.16 ns 2.16 ns 4
|
||||
Concat stringa and hex number and literal by e_concat to simstr::stringa_cv 1.73 % 1.73 % 4
|
||||
Subst stringa and hex number by e_subst literal to simstr::stringa_mean 172 ns 172 ns 4
|
||||
Subst stringa and hex number by e_subst literal to simstr::stringa_median 171 ns 171 ns 4
|
||||
Subst stringa and hex number by e_subst literal to simstr::stringa_stddev 4.63 ns 4.63 ns 4
|
||||
Subst stringa and hex number by e_subst literal to simstr::stringa_cv 2.69 % 2.69 % 4
|
||||
Subst stringa and hex number by e_vsubst stra to simstr::stringa_mean 280 ns 280 ns 4
|
||||
Subst stringa and hex number by e_vsubst stra to simstr::stringa_median 279 ns 279 ns 4
|
||||
Subst stringa and hex number by e_vsubst stra to simstr::stringa_stddev 5.80 ns 5.80 ns 4
|
||||
Subst stringa and hex number by e_vsubst stra to simstr::stringa_cv 2.07 % 2.07 % 4
|
||||
---- format/vformat and subst/vsubst octal number to 32 symbols result ----/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
"abcdefghihklmopqr "_ss + i / 0x8a010_fmt + " end"_mean 261 ns 261 ns 4
|
||||
"abcdefghihklmopqr "_ss + i / 0x8a010_fmt + " end"_median 261 ns 261 ns 4
|
||||
"abcdefghihklmopqr "_ss + i / 0x8a010_fmt + " end"_stddev 4.51 ns 4.51 ns 4
|
||||
"abcdefghihklmopqr "_ss + i / 0x8a010_fmt + " end"_cv 1.73 % 1.73 % 4
|
||||
e_subst("abcdefghihklmopqr {} end", i / 0x8a010_fmt)_mean 315 ns 315 ns 4
|
||||
e_subst("abcdefghihklmopqr {} end", i / 0x8a010_fmt)_median 316 ns 316 ns 4
|
||||
e_subst("abcdefghihklmopqr {} end", i / 0x8a010_fmt)_stddev 3.45 ns 3.45 ns 4
|
||||
e_subst("abcdefghihklmopqr {} end", i / 0x8a010_fmt)_cv 1.09 % 1.09 % 4
|
||||
e_vsubst(pattern, i / 0x8a010_fmt)_mean 593 ns 593 ns 4
|
||||
e_vsubst(pattern, i / 0x8a010_fmt)_median 587 ns 587 ns 4
|
||||
e_vsubst(pattern, i / 0x8a010_fmt)_stddev 13.1 ns 13.1 ns 4
|
||||
e_vsubst(pattern, i / 0x8a010_fmt)_cv 2.21 % 2.21 % 4
|
||||
fmt::format(FMT_COMPILE("abcdefghihklmopqr {:#010o} end"), i)_mean 629 ns 629 ns 4
|
||||
fmt::format(FMT_COMPILE("abcdefghihklmopqr {:#010o} end"), i)_median 631 ns 631 ns 4
|
||||
fmt::format(FMT_COMPILE("abcdefghihklmopqr {:#010o} end"), i)_stddev 19.2 ns 19.2 ns 4
|
||||
fmt::format(FMT_COMPILE("abcdefghihklmopqr {:#010o} end"), i)_cv 3.06 % 3.06 % 4
|
||||
fmt::format("abcdefghihklmopqr {:#010o} end", i)_mean 788 ns 788 ns 4
|
||||
fmt::format("abcdefghihklmopqr {:#010o} end", i)_median 794 ns 794 ns 4
|
||||
fmt::format("abcdefghihklmopqr {:#010o} end", i)_stddev 12.1 ns 12.1 ns 4
|
||||
fmt::format("abcdefghihklmopqr {:#010o} end", i)_cv 1.54 % 1.54 % 4
|
||||
std::format("abcdefghihklmopqr {:#010o} end", i)_mean 1171 ns 1171 ns 4
|
||||
std::format("abcdefghihklmopqr {:#010o} end", i)_median 1170 ns 1170 ns 4
|
||||
std::format("abcdefghihklmopqr {:#010o} end", i)_stddev 4.63 ns 4.63 ns 4
|
||||
std::format("abcdefghihklmopqr {:#010o} end", i)_cv 0.40 % 0.40 % 4
|
||||
std::vformat(pattern, std::make_format_args(i))_mean 1176 ns 1176 ns 4
|
||||
std::vformat(pattern, std::make_format_args(i))_median 1174 ns 1174 ns 4
|
||||
std::vformat(pattern, std::make_format_args(i))_stddev 12.9 ns 12.9 ns 4
|
||||
std::vformat(pattern, std::make_format_args(i))_cv 1.09 % 1.09 % 4
|
||||
std::format with std::formatted_size_mean 2267 ns 2267 ns 4
|
||||
std::format with std::formatted_size_median 2276 ns 2276 ns 4
|
||||
std::format with std::formatted_size_stddev 38.4 ns 38.4 ns 4
|
||||
std::format with std::formatted_size_cv 1.69 % 1.69 % 4
|
||||
strm << "abcdefghihklmopqr 0" << std::oct << std::setw(9) << std::setfill('0') << i << " end"_mean 2021 ns 2021 ns 4
|
||||
strm << "abcdefghihklmopqr 0" << std::oct << std::setw(9) << std::setfill('0') << i << " end"_median 2023 ns 2023 ns 4
|
||||
strm << "abcdefghihklmopqr 0" << std::oct << std::setw(9) << std::setfill('0') << i << " end"_stddev 41.5 ns 41.5 ns 4
|
||||
strm << "abcdefghihklmopqr 0" << std::oct << std::setw(9) << std::setfill('0') << i << " end"_cv 2.05 % 2.05 % 4
|
||||
----- Concatenate string + "Literal" ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Concat std::string by std to std::string_mean 47.9 ns 47.9 ns 4
|
||||
Concat std::string by std to std::string_median 47.9 ns 47.9 ns 4
|
||||
Concat std::string by std to std::string_stddev 0.383 ns 0.383 ns 4
|
||||
Concat std::string by std to std::string_cv 0.80 % 0.80 % 4
|
||||
Concat std::string by StrExpr to std::string_mean 35.3 ns 35.3 ns 4
|
||||
Concat std::string by StrExpr to std::string_median 35.3 ns 35.3 ns 4
|
||||
Concat std::string by StrExpr to std::string_stddev 0.618 ns 0.618 ns 4
|
||||
Concat std::string by StrExpr to std::string_cv 1.75 % 1.75 % 4
|
||||
Concat stringa by StrExpr to stringa_mean 27.4 ns 27.4 ns 4
|
||||
Concat stringa by StrExpr to stringa_median 27.4 ns 27.4 ns 4
|
||||
Concat stringa by StrExpr to stringa_stddev 0.154 ns 0.153 ns 4
|
||||
Concat stringa by StrExpr to stringa_cv 0.56 % 0.56 % 4
|
||||
----- Find three concatenated string in string_view -----/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Find concat three std::string_mean 119 ns 119 ns 4
|
||||
Find concat three std::string_median 118 ns 118 ns 4
|
||||
Find concat three std::string_stddev 1.87 ns 1.87 ns 4
|
||||
Find concat three std::string_cv 1.57 % 1.57 % 4
|
||||
Find concat three strexpr_mean 38.2 ns 38.2 ns 4
|
||||
Find concat three strexpr_median 38.2 ns 38.2 ns 4
|
||||
Find concat three strexpr_stddev 0.339 ns 0.339 ns 4
|
||||
Find concat three strexpr_cv 0.89 % 0.89 % 4
|
||||
Find concat three simstr_mean 15.6 ns 15.6 ns 4
|
||||
Find concat three simstr_median 15.6 ns 15.6 ns 4
|
||||
Find concat three simstr_stddev 0.214 ns 0.214 ns 4
|
||||
Find concat three simstr_cv 1.37 % 1.37 % 4
|
||||
Find concat three stringzilla string_mean 125 ns 125 ns 4
|
||||
Find concat three stringzilla string_median 125 ns 125 ns 4
|
||||
Find concat three stringzilla string_stddev 1.18 ns 1.18 ns 4
|
||||
Find concat three stringzilla string_cv 0.94 % 0.94 % 4
|
||||
----- Build Type Name ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
BuildTypeNameStr 0/0_mean 8.65 ns 8.65 ns 4
|
||||
BuildTypeNameStr 0/0_median 8.66 ns 8.66 ns 4
|
||||
BuildTypeNameStr 0/0_stddev 0.131 ns 0.131 ns 4
|
||||
BuildTypeNameStr 0/0_cv 1.51 % 1.51 % 4
|
||||
BuildTypeNameExp 0/0_mean 6.99 ns 6.99 ns 4
|
||||
BuildTypeNameExp 0/0_median 7.01 ns 7.01 ns 4
|
||||
BuildTypeNameExp 0/0_stddev 0.134 ns 0.134 ns 4
|
||||
BuildTypeNameExp 0/0_cv 1.92 % 1.92 % 4
|
||||
BuildTypeNameSim 0/0_mean 4.97 ns 4.97 ns 4
|
||||
BuildTypeNameSim 0/0_median 4.98 ns 4.98 ns 4
|
||||
BuildTypeNameSim 0/0_stddev 0.065 ns 0.065 ns 4
|
||||
BuildTypeNameSim 0/0_cv 1.31 % 1.31 % 4
|
||||
BuildTypeNameStr 10/10_mean 76.6 ns 76.6 ns 4
|
||||
BuildTypeNameStr 10/10_median 76.1 ns 76.1 ns 4
|
||||
BuildTypeNameStr 10/10_stddev 1.27 ns 1.27 ns 4
|
||||
BuildTypeNameStr 10/10_cv 1.65 % 1.65 % 4
|
||||
BuildTypeNameExp 10/10_mean 27.9 ns 27.9 ns 4
|
||||
BuildTypeNameExp 10/10_median 27.9 ns 27.9 ns 4
|
||||
BuildTypeNameExp 10/10_stddev 0.740 ns 0.740 ns 4
|
||||
BuildTypeNameExp 10/10_cv 2.66 % 2.66 % 4
|
||||
BuildTypeNameSim 10/10_mean 22.6 ns 22.6 ns 4
|
||||
BuildTypeNameSim 10/10_median 22.3 ns 22.3 ns 4
|
||||
BuildTypeNameSim 10/10_stddev 0.683 ns 0.683 ns 4
|
||||
BuildTypeNameSim 10/10_cv 3.02 % 3.02 % 4
|
||||
----- Replace string by copy -----/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Concat with replace str_mean 236 ns 236 ns 4
|
||||
Concat with replace str_median 236 ns 236 ns 4
|
||||
Concat with replace str_stddev 4.01 ns 4.01 ns 4
|
||||
Concat with replace str_cv 1.70 % 1.70 % 4
|
||||
Concat with replace exp_mean 135 ns 135 ns 4
|
||||
Concat with replace exp_median 134 ns 134 ns 4
|
||||
Concat with replace exp_stddev 3.94 ns 3.94 ns 4
|
||||
Concat with replace exp_cv 2.92 % 2.92 % 4
|
||||
----- Create Empty Str ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string e;_mean 1.13 ns 1.13 ns 4
|
||||
std::string e;_median 1.13 ns 1.13 ns 4
|
||||
std::string e;_stddev 0.012 ns 0.012 ns 4
|
||||
std::string e;_cv 1.09 % 1.09 % 4
|
||||
std::string_view e;_mean 0.754 ns 0.754 ns 4
|
||||
std::string_view e;_median 0.751 ns 0.751 ns 4
|
||||
std::string_view e;_stddev 0.013 ns 0.013 ns 4
|
||||
std::string_view e;_cv 1.68 % 1.68 % 4
|
||||
ssa e;_mean 0.187 ns 0.187 ns 4
|
||||
ssa e;_median 0.186 ns 0.186 ns 4
|
||||
ssa e;_stddev 0.002 ns 0.002 ns 4
|
||||
ssa e;_cv 1.20 % 1.20 % 4
|
||||
stringa e;_mean 0.753 ns 0.753 ns 4
|
||||
stringa e;_median 0.757 ns 0.757 ns 4
|
||||
stringa e;_stddev 0.011 ns 0.011 ns 4
|
||||
stringa e;_cv 1.52 % 1.52 % 4
|
||||
lstringa<20> e;_mean 1.14 ns 1.14 ns 4
|
||||
lstringa<20> e;_median 1.15 ns 1.15 ns 4
|
||||
lstringa<20> e;_stddev 0.016 ns 0.016 ns 4
|
||||
lstringa<20> e;_cv 1.44 % 1.44 % 4
|
||||
lstringa<40> e;_mean 1.15 ns 1.15 ns 4
|
||||
lstringa<40> e;_median 1.15 ns 1.15 ns 4
|
||||
lstringa<40> e;_stddev 0.016 ns 0.016 ns 4
|
||||
lstringa<40> e;_cv 1.39 % 1.39 % 4
|
||||
----- Create Str from short literal (9 symbols) --------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string e = "Test text";_mean 1.89 ns 1.89 ns 4
|
||||
std::string e = "Test text";_median 1.89 ns 1.89 ns 4
|
||||
std::string e = "Test text";_stddev 0.034 ns 0.034 ns 4
|
||||
std::string e = "Test text";_cv 1.80 % 1.80 % 4
|
||||
std::string_view e = "Test text";_mean 0.754 ns 0.754 ns 4
|
||||
std::string_view e = "Test text";_median 0.753 ns 0.753 ns 4
|
||||
std::string_view e = "Test text";_stddev 0.007 ns 0.007 ns 4
|
||||
std::string_view e = "Test text";_cv 0.97 % 0.97 % 4
|
||||
ssa e = "Test text";_mean 0.757 ns 0.757 ns 4
|
||||
ssa e = "Test text";_median 0.761 ns 0.761 ns 4
|
||||
ssa e = "Test text";_stddev 0.011 ns 0.011 ns 4
|
||||
ssa e = "Test text";_cv 1.44 % 1.44 % 4
|
||||
stringa e = "Test text";_mean 1.13 ns 1.13 ns 4
|
||||
stringa e = "Test text";_median 1.13 ns 1.13 ns 4
|
||||
stringa e = "Test text";_stddev 0.014 ns 0.014 ns 4
|
||||
stringa e = "Test text";_cv 1.26 % 1.26 % 4
|
||||
lstringa<20> e = "Test text";_mean 1.92 ns 1.92 ns 4
|
||||
lstringa<20> e = "Test text";_median 1.89 ns 1.89 ns 4
|
||||
lstringa<20> e = "Test text";_stddev 0.080 ns 0.080 ns 4
|
||||
lstringa<20> e = "Test text";_cv 4.18 % 4.18 % 4
|
||||
lstringa<40> e = "Test text";_mean 1.90 ns 1.90 ns 4
|
||||
lstringa<40> e = "Test text";_median 1.90 ns 1.90 ns 4
|
||||
lstringa<40> e = "Test text";_stddev 0.021 ns 0.021 ns 4
|
||||
lstringa<40> e = "Test text";_cv 1.08 % 1.08 % 4
|
||||
----- Create Str from long literal (30 symbols) ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string e = "123456789012345678901234567890";_mean 19.7 ns 19.7 ns 4
|
||||
std::string e = "123456789012345678901234567890";_median 19.8 ns 19.8 ns 4
|
||||
std::string e = "123456789012345678901234567890";_stddev 0.335 ns 0.335 ns 4
|
||||
std::string e = "123456789012345678901234567890";_cv 1.70 % 1.70 % 4
|
||||
std::string_view e = "123456789012345678901234567890";_mean 0.751 ns 0.751 ns 4
|
||||
std::string_view e = "123456789012345678901234567890";_median 0.752 ns 0.752 ns 4
|
||||
std::string_view e = "123456789012345678901234567890";_stddev 0.009 ns 0.009 ns 4
|
||||
std::string_view e = "123456789012345678901234567890";_cv 1.19 % 1.19 % 4
|
||||
ssa e = "123456789012345678901234567890";_mean 0.761 ns 0.761 ns 4
|
||||
ssa e = "123456789012345678901234567890";_median 0.764 ns 0.764 ns 4
|
||||
ssa e = "123456789012345678901234567890";_stddev 0.014 ns 0.014 ns 4
|
||||
ssa e = "123456789012345678901234567890";_cv 1.89 % 1.89 % 4
|
||||
stringa e = "123456789012345678901234567890";_mean 1.13 ns 1.13 ns 4
|
||||
stringa e = "123456789012345678901234567890";_median 1.14 ns 1.14 ns 4
|
||||
stringa e = "123456789012345678901234567890";_stddev 0.015 ns 0.015 ns 4
|
||||
stringa e = "123456789012345678901234567890";_cv 1.34 % 1.34 % 4
|
||||
lstringa<20> e = "123456789012345678901234567890";_mean 18.3 ns 18.3 ns 4
|
||||
lstringa<20> e = "123456789012345678901234567890";_median 18.3 ns 18.3 ns 4
|
||||
lstringa<20> e = "123456789012345678901234567890";_stddev 0.389 ns 0.389 ns 4
|
||||
lstringa<20> e = "123456789012345678901234567890";_cv 2.12 % 2.12 % 4
|
||||
lstringa<40> e = "123456789012345678901234567890";_mean 1.91 ns 1.91 ns 4
|
||||
lstringa<40> e = "123456789012345678901234567890";_median 1.91 ns 1.91 ns 4
|
||||
lstringa<40> e = "123456789012345678901234567890";_stddev 0.011 ns 0.011 ns 4
|
||||
lstringa<40> e = "123456789012345678901234567890";_cv 0.60 % 0.60 % 4
|
||||
----- Create copy of Str with 9 symbols ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string e = "Test text"; auto c{e};_mean 5.03 ns 5.03 ns 4
|
||||
std::string e = "Test text"; auto c{e};_median 5.05 ns 5.05 ns 4
|
||||
std::string e = "Test text"; auto c{e};_stddev 0.100 ns 0.100 ns 4
|
||||
std::string e = "Test text"; auto c{e};_cv 1.98 % 1.98 % 4
|
||||
std::string_view e = "Test text"; auto c{e};_mean 0.388 ns 0.388 ns 4
|
||||
std::string_view e = "Test text"; auto c{e};_median 0.389 ns 0.389 ns 4
|
||||
std::string_view e = "Test text"; auto c{e};_stddev 0.003 ns 0.003 ns 4
|
||||
std::string_view e = "Test text"; auto c{e};_cv 0.81 % 0.81 % 4
|
||||
ssa e = "Test text"; auto c{e};_mean 0.388 ns 0.388 ns 4
|
||||
ssa e = "Test text"; auto c{e};_median 0.391 ns 0.391 ns 4
|
||||
ssa e = "Test text"; auto c{e};_stddev 0.009 ns 0.009 ns 4
|
||||
ssa e = "Test text"; auto c{e};_cv 2.21 % 2.21 % 4
|
||||
stringa e = "Test text"; auto c{e};_mean 1.13 ns 1.13 ns 4
|
||||
stringa e = "Test text"; auto c{e};_median 1.13 ns 1.13 ns 4
|
||||
stringa e = "Test text"; auto c{e};_stddev 0.017 ns 0.017 ns 4
|
||||
stringa e = "Test text"; auto c{e};_cv 1.53 % 1.53 % 4
|
||||
lstringa<20> e = "Test text"; auto c{e};_mean 1.15 ns 1.15 ns 4
|
||||
lstringa<20> e = "Test text"; auto c{e};_median 1.15 ns 1.15 ns 4
|
||||
lstringa<20> e = "Test text"; auto c{e};_stddev 0.018 ns 0.018 ns 4
|
||||
lstringa<20> e = "Test text"; auto c{e};_cv 1.60 % 1.60 % 4
|
||||
lstringa<40> e = "Test text"; auto c{e};_mean 1.15 ns 1.15 ns 4
|
||||
lstringa<40> e = "Test text"; auto c{e};_median 1.15 ns 1.15 ns 4
|
||||
lstringa<40> e = "Test text"; auto c{e};_stddev 0.016 ns 0.016 ns 4
|
||||
lstringa<40> e = "Test text"; auto c{e};_cv 1.38 % 1.38 % 4
|
||||
----- Create copy of Str with 30 symbols ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string e = "123456789012345678901234567890"; auto c{e};_mean 23.2 ns 23.2 ns 4
|
||||
std::string e = "123456789012345678901234567890"; auto c{e};_median 23.4 ns 23.4 ns 4
|
||||
std::string e = "123456789012345678901234567890"; auto c{e};_stddev 0.477 ns 0.477 ns 4
|
||||
std::string e = "123456789012345678901234567890"; auto c{e};_cv 2.06 % 2.06 % 4
|
||||
std::string_view e = "123456789012345678901234567890"; auto c{e};_mean 0.759 ns 0.759 ns 4
|
||||
std::string_view e = "123456789012345678901234567890"; auto c{e};_median 0.760 ns 0.760 ns 4
|
||||
std::string_view e = "123456789012345678901234567890"; auto c{e};_stddev 0.004 ns 0.004 ns 4
|
||||
std::string_view e = "123456789012345678901234567890"; auto c{e};_cv 0.54 % 0.54 % 4
|
||||
ssa e = "123456789012345678901234567890"; auto c{e};_mean 0.758 ns 0.758 ns 4
|
||||
ssa e = "123456789012345678901234567890"; auto c{e};_median 0.754 ns 0.754 ns 4
|
||||
ssa e = "123456789012345678901234567890"; auto c{e};_stddev 0.017 ns 0.017 ns 4
|
||||
ssa e = "123456789012345678901234567890"; auto c{e};_cv 2.19 % 2.19 % 4
|
||||
stringa e = "123456789012345678901234567890"; auto c{e};_mean 6.85 ns 6.85 ns 4
|
||||
stringa e = "123456789012345678901234567890"; auto c{e};_median 6.85 ns 6.85 ns 4
|
||||
stringa e = "123456789012345678901234567890"; auto c{e};_stddev 0.024 ns 0.024 ns 4
|
||||
stringa e = "123456789012345678901234567890"; auto c{e};_cv 0.36 % 0.36 % 4
|
||||
lstringa<20> e = "123456789012345678901234567890"; auto c{e};_mean 17.7 ns 17.7 ns 4
|
||||
lstringa<20> e = "123456789012345678901234567890"; auto c{e};_median 17.6 ns 17.6 ns 4
|
||||
lstringa<20> e = "123456789012345678901234567890"; auto c{e};_stddev 0.244 ns 0.244 ns 4
|
||||
lstringa<20> e = "123456789012345678901234567890"; auto c{e};_cv 1.38 % 1.38 % 4
|
||||
lstringa<40> e = "123456789012345678901234567890"; auto c{e};_mean 4.18 ns 4.18 ns 4
|
||||
lstringa<40> e = "123456789012345678901234567890"; auto c{e};_median 4.16 ns 4.16 ns 4
|
||||
lstringa<40> e = "123456789012345678901234567890"; auto c{e};_stddev 0.121 ns 0.121 ns 4
|
||||
lstringa<40> e = "123456789012345678901234567890"; auto c{e};_cv 2.90 % 2.90 % 4
|
||||
----- Find 9 symbols text in end of 99 symbols text ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
sz::string::find;_mean 87.9 ns 87.9 ns 4
|
||||
sz::string::find;_median 87.9 ns 87.9 ns 4
|
||||
sz::string::find;_stddev 1.17 ns 1.17 ns 4
|
||||
sz::string::find;_cv 1.33 % 1.33 % 4
|
||||
std::string::find;_mean 6.95 ns 6.95 ns 4
|
||||
std::string::find;_median 6.95 ns 6.95 ns 4
|
||||
std::string::find;_stddev 0.069 ns 0.069 ns 4
|
||||
std::string::find;_cv 0.99 % 0.99 % 4
|
||||
std::string_view::find;_mean 7.39 ns 7.39 ns 4
|
||||
std::string_view::find;_median 7.40 ns 7.40 ns 4
|
||||
std::string_view::find;_stddev 0.118 ns 0.118 ns 4
|
||||
std::string_view::find;_cv 1.59 % 1.59 % 4
|
||||
ssa::find;_mean 6.87 ns 6.87 ns 4
|
||||
ssa::find;_median 6.88 ns 6.88 ns 4
|
||||
ssa::find;_stddev 0.131 ns 0.131 ns 4
|
||||
ssa::find;_cv 1.90 % 1.90 % 4
|
||||
stringa::find;_mean 7.21 ns 7.21 ns 4
|
||||
stringa::find;_median 7.18 ns 7.18 ns 4
|
||||
stringa::find;_stddev 0.196 ns 0.196 ns 4
|
||||
stringa::find;_cv 2.72 % 2.72 % 4
|
||||
lstringa<20>::find;_mean 6.52 ns 6.52 ns 4
|
||||
lstringa<20>::find;_median 6.56 ns 6.56 ns 4
|
||||
lstringa<20>::find;_stddev 0.116 ns 0.116 ns 4
|
||||
lstringa<20>::find;_cv 1.78 % 1.78 % 4
|
||||
lstringa<40>::find;_mean 6.49 ns 6.49 ns 4
|
||||
lstringa<40>::find;_median 6.48 ns 6.48 ns 4
|
||||
lstringa<40>::find;_stddev 0.150 ns 0.150 ns 4
|
||||
lstringa<40>::find;_cv 2.31 % 2.31 % 4
|
||||
------- Copy not literal Str with N symbols ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string copy{str_with_len_N};/15_mean 5.01 ns 5.01 ns 4
|
||||
std::string copy{str_with_len_N};/15_median 5.01 ns 5.02 ns 4
|
||||
std::string copy{str_with_len_N};/15_stddev 0.085 ns 0.085 ns 4
|
||||
std::string copy{str_with_len_N};/15_cv 1.70 % 1.70 % 4
|
||||
std::string copy{str_with_len_N};/16_mean 29.4 ns 29.4 ns 4
|
||||
std::string copy{str_with_len_N};/16_median 29.6 ns 29.6 ns 4
|
||||
std::string copy{str_with_len_N};/16_stddev 1.16 ns 1.16 ns 4
|
||||
std::string copy{str_with_len_N};/16_cv 3.93 % 3.93 % 4
|
||||
std::string copy{str_with_len_N};/23_mean 28.9 ns 28.9 ns 4
|
||||
std::string copy{str_with_len_N};/23_median 28.8 ns 28.8 ns 4
|
||||
std::string copy{str_with_len_N};/23_stddev 0.401 ns 0.401 ns 4
|
||||
std::string copy{str_with_len_N};/23_cv 1.39 % 1.39 % 4
|
||||
std::string copy{str_with_len_N};/24_mean 22.3 ns 22.3 ns 4
|
||||
std::string copy{str_with_len_N};/24_median 22.4 ns 22.4 ns 4
|
||||
std::string copy{str_with_len_N};/24_stddev 0.245 ns 0.245 ns 4
|
||||
std::string copy{str_with_len_N};/24_cv 1.10 % 1.10 % 4
|
||||
std::string copy{str_with_len_N};/32_mean 21.5 ns 21.5 ns 4
|
||||
std::string copy{str_with_len_N};/32_median 21.5 ns 21.5 ns 4
|
||||
std::string copy{str_with_len_N};/32_stddev 0.170 ns 0.170 ns 4
|
||||
std::string copy{str_with_len_N};/32_cv 0.79 % 0.79 % 4
|
||||
std::string copy{str_with_len_N};/64_mean 24.6 ns 24.6 ns 4
|
||||
std::string copy{str_with_len_N};/64_median 24.6 ns 24.6 ns 4
|
||||
std::string copy{str_with_len_N};/64_stddev 0.699 ns 0.699 ns 4
|
||||
std::string copy{str_with_len_N};/64_cv 2.85 % 2.85 % 4
|
||||
std::string copy{str_with_len_N};/128_mean 24.2 ns 24.2 ns 4
|
||||
std::string copy{str_with_len_N};/128_median 24.4 ns 24.4 ns 4
|
||||
std::string copy{str_with_len_N};/128_stddev 0.806 ns 0.806 ns 4
|
||||
std::string copy{str_with_len_N};/128_cv 3.33 % 3.33 % 4
|
||||
std::string copy{str_with_len_N};/256_mean 25.7 ns 25.7 ns 4
|
||||
std::string copy{str_with_len_N};/256_median 25.8 ns 25.8 ns 4
|
||||
std::string copy{str_with_len_N};/256_stddev 0.425 ns 0.425 ns 4
|
||||
std::string copy{str_with_len_N};/256_cv 1.65 % 1.65 % 4
|
||||
std::string copy{str_with_len_N};/512_mean 28.5 ns 28.5 ns 4
|
||||
std::string copy{str_with_len_N};/512_median 28.4 ns 28.4 ns 4
|
||||
std::string copy{str_with_len_N};/512_stddev 0.749 ns 0.749 ns 4
|
||||
std::string copy{str_with_len_N};/512_cv 2.63 % 2.63 % 4
|
||||
std::string copy{str_with_len_N};/1024_mean 33.4 ns 33.4 ns 4
|
||||
std::string copy{str_with_len_N};/1024_median 33.5 ns 33.5 ns 4
|
||||
std::string copy{str_with_len_N};/1024_stddev 0.562 ns 0.562 ns 4
|
||||
std::string copy{str_with_len_N};/1024_cv 1.68 % 1.68 % 4
|
||||
std::string copy{str_with_len_N};/2048_mean 122 ns 122 ns 4
|
||||
std::string copy{str_with_len_N};/2048_median 122 ns 122 ns 4
|
||||
std::string copy{str_with_len_N};/2048_stddev 2.42 ns 2.42 ns 4
|
||||
std::string copy{str_with_len_N};/2048_cv 1.99 % 1.99 % 4
|
||||
std::string copy{str_with_len_N};/4096_mean 157 ns 157 ns 4
|
||||
std::string copy{str_with_len_N};/4096_median 157 ns 157 ns 4
|
||||
std::string copy{str_with_len_N};/4096_stddev 7.01 ns 7.01 ns 4
|
||||
std::string copy{str_with_len_N};/4096_cv 4.47 % 4.47 % 4
|
||||
stringa copy{str_with_len_N};/15_mean 1.13 ns 1.13 ns 4
|
||||
stringa copy{str_with_len_N};/15_median 1.13 ns 1.13 ns 4
|
||||
stringa copy{str_with_len_N};/15_stddev 0.015 ns 0.015 ns 4
|
||||
stringa copy{str_with_len_N};/15_cv 1.32 % 1.32 % 4
|
||||
stringa copy{str_with_len_N};/16_mean 1.15 ns 1.15 ns 4
|
||||
stringa copy{str_with_len_N};/16_median 1.16 ns 1.16 ns 4
|
||||
stringa copy{str_with_len_N};/16_stddev 0.020 ns 0.020 ns 4
|
||||
stringa copy{str_with_len_N};/16_cv 1.73 % 1.73 % 4
|
||||
stringa copy{str_with_len_N};/23_mean 1.13 ns 1.13 ns 4
|
||||
stringa copy{str_with_len_N};/23_median 1.13 ns 1.13 ns 4
|
||||
stringa copy{str_with_len_N};/23_stddev 0.022 ns 0.022 ns 4
|
||||
stringa copy{str_with_len_N};/23_cv 1.93 % 1.93 % 4
|
||||
stringa copy{str_with_len_N};/24_mean 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/24_median 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/24_stddev 0.124 ns 0.124 ns 4
|
||||
stringa copy{str_with_len_N};/24_cv 0.76 % 0.76 % 4
|
||||
stringa copy{str_with_len_N};/32_mean 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/32_median 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/32_stddev 0.140 ns 0.140 ns 4
|
||||
stringa copy{str_with_len_N};/32_cv 0.85 % 0.85 % 4
|
||||
stringa copy{str_with_len_N};/64_mean 16.5 ns 16.5 ns 4
|
||||
stringa copy{str_with_len_N};/64_median 16.5 ns 16.5 ns 4
|
||||
stringa copy{str_with_len_N};/64_stddev 0.159 ns 0.159 ns 4
|
||||
stringa copy{str_with_len_N};/64_cv 0.97 % 0.97 % 4
|
||||
stringa copy{str_with_len_N};/128_mean 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/128_median 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/128_stddev 0.099 ns 0.099 ns 4
|
||||
stringa copy{str_with_len_N};/128_cv 0.60 % 0.60 % 4
|
||||
stringa copy{str_with_len_N};/256_mean 16.5 ns 16.5 ns 4
|
||||
stringa copy{str_with_len_N};/256_median 16.5 ns 16.5 ns 4
|
||||
stringa copy{str_with_len_N};/256_stddev 0.095 ns 0.095 ns 4
|
||||
stringa copy{str_with_len_N};/256_cv 0.58 % 0.58 % 4
|
||||
stringa copy{str_with_len_N};/512_mean 16.3 ns 16.3 ns 4
|
||||
stringa copy{str_with_len_N};/512_median 16.3 ns 16.3 ns 4
|
||||
stringa copy{str_with_len_N};/512_stddev 0.048 ns 0.048 ns 4
|
||||
stringa copy{str_with_len_N};/512_cv 0.29 % 0.29 % 4
|
||||
stringa copy{str_with_len_N};/1024_mean 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/1024_median 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/1024_stddev 0.066 ns 0.066 ns 4
|
||||
stringa copy{str_with_len_N};/1024_cv 0.40 % 0.40 % 4
|
||||
stringa copy{str_with_len_N};/2048_mean 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/2048_median 16.4 ns 16.4 ns 4
|
||||
stringa copy{str_with_len_N};/2048_stddev 0.039 ns 0.039 ns 4
|
||||
stringa copy{str_with_len_N};/2048_cv 0.24 % 0.24 % 4
|
||||
stringa copy{str_with_len_N};/4096_mean 16.5 ns 16.5 ns 4
|
||||
stringa copy{str_with_len_N};/4096_median 16.5 ns 16.5 ns 4
|
||||
stringa copy{str_with_len_N};/4096_stddev 0.072 ns 0.072 ns 4
|
||||
stringa copy{str_with_len_N};/4096_cv 0.43 % 0.43 % 4
|
||||
lstringa<16> copy{str_with_len_N};/15_mean 1.15 ns 1.15 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/15_median 1.16 ns 1.16 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/15_stddev 0.021 ns 0.021 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/15_cv 1.83 % 1.83 % 4
|
||||
lstringa<16> copy{str_with_len_N};/16_mean 4.89 ns 4.89 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/16_median 4.91 ns 4.91 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/16_stddev 0.063 ns 0.063 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/16_cv 1.29 % 1.29 % 4
|
||||
lstringa<16> copy{str_with_len_N};/23_mean 4.91 ns 4.91 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/23_median 4.89 ns 4.89 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/23_stddev 0.079 ns 0.079 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/23_cv 1.60 % 1.60 % 4
|
||||
lstringa<16> copy{str_with_len_N};/24_mean 22.4 ns 22.4 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/24_median 22.1 ns 22.1 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/24_stddev 0.925 ns 0.925 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/24_cv 4.12 % 4.12 % 4
|
||||
lstringa<16> copy{str_with_len_N};/32_mean 22.5 ns 22.5 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/32_median 22.4 ns 22.4 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/32_stddev 0.344 ns 0.344 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/32_cv 1.53 % 1.53 % 4
|
||||
lstringa<16> copy{str_with_len_N};/64_mean 24.3 ns 24.3 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/64_median 24.2 ns 24.2 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/64_stddev 0.482 ns 0.482 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/64_cv 1.99 % 1.99 % 4
|
||||
lstringa<16> copy{str_with_len_N};/128_mean 33.8 ns 33.9 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/128_median 33.9 ns 33.9 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/128_stddev 0.822 ns 0.822 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/128_cv 2.43 % 2.43 % 4
|
||||
lstringa<16> copy{str_with_len_N};/256_mean 25.9 ns 25.9 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/256_median 25.9 ns 25.9 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/256_stddev 0.442 ns 0.442 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/256_cv 1.71 % 1.71 % 4
|
||||
lstringa<16> copy{str_with_len_N};/512_mean 34.8 ns 34.8 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/512_median 34.9 ns 34.9 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/512_stddev 0.270 ns 0.270 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/512_cv 0.78 % 0.78 % 4
|
||||
lstringa<16> copy{str_with_len_N};/1024_mean 99.7 ns 99.7 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/1024_median 99.2 ns 99.2 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/1024_stddev 2.75 ns 2.75 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/1024_cv 2.75 % 2.76 % 4
|
||||
lstringa<16> copy{str_with_len_N};/2048_mean 110 ns 110 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/2048_median 111 ns 111 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/2048_stddev 3.07 ns 3.07 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/2048_cv 2.78 % 2.78 % 4
|
||||
lstringa<16> copy{str_with_len_N};/4096_mean 129 ns 129 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/4096_median 130 ns 130 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/4096_stddev 2.98 ns 2.98 ns 4
|
||||
lstringa<16> copy{str_with_len_N};/4096_cv 2.32 % 2.32 % 4
|
||||
lstringa<512> copy{str_with_len_N};/15_mean 1.15 ns 1.15 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/15_median 1.15 ns 1.15 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/15_stddev 0.018 ns 0.018 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/15_cv 1.55 % 1.55 % 4
|
||||
lstringa<512> copy{str_with_len_N};/16_mean 4.22 ns 4.22 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/16_median 4.20 ns 4.20 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/16_stddev 0.108 ns 0.108 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/16_cv 2.57 % 2.57 % 4
|
||||
lstringa<512> copy{str_with_len_N};/23_mean 4.24 ns 4.24 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/23_median 4.23 ns 4.23 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/23_stddev 0.108 ns 0.108 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/23_cv 2.55 % 2.55 % 4
|
||||
lstringa<512> copy{str_with_len_N};/24_mean 4.26 ns 4.26 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/24_median 4.24 ns 4.24 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/24_stddev 0.075 ns 0.075 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/24_cv 1.77 % 1.77 % 4
|
||||
lstringa<512> copy{str_with_len_N};/32_mean 4.20 ns 4.20 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/32_median 4.17 ns 4.17 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/32_stddev 0.082 ns 0.082 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/32_cv 1.95 % 1.95 % 4
|
||||
lstringa<512> copy{str_with_len_N};/64_mean 5.67 ns 5.67 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/64_median 5.67 ns 5.67 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/64_stddev 0.074 ns 0.074 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/64_cv 1.31 % 1.31 % 4
|
||||
lstringa<512> copy{str_with_len_N};/128_mean 6.29 ns 6.29 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/128_median 6.30 ns 6.30 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/128_stddev 0.125 ns 0.125 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/128_cv 1.98 % 1.98 % 4
|
||||
lstringa<512> copy{str_with_len_N};/256_mean 7.98 ns 7.98 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/256_median 7.98 ns 7.98 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/256_stddev 0.053 ns 0.053 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/256_cv 0.66 % 0.66 % 4
|
||||
lstringa<512> copy{str_with_len_N};/512_mean 10.2 ns 10.2 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/512_median 10.2 ns 10.2 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/512_stddev 0.100 ns 0.100 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/512_cv 0.98 % 0.98 % 4
|
||||
lstringa<512> copy{str_with_len_N};/1024_mean 96.5 ns 96.5 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/1024_median 95.5 ns 95.5 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/1024_stddev 3.21 ns 3.21 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/1024_cv 3.32 % 3.32 % 4
|
||||
lstringa<512> copy{str_with_len_N};/2048_mean 103 ns 103 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/2048_median 103 ns 103 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/2048_stddev 2.63 ns 2.63 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/2048_cv 2.55 % 2.55 % 4
|
||||
lstringa<512> copy{str_with_len_N};/4096_mean 126 ns 126 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/4096_median 126 ns 126 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/4096_stddev 5.68 ns 5.68 ns 4
|
||||
lstringa<512> copy{str_with_len_N};/4096_cv 4.51 % 4.51 % 4
|
||||
----- Convert to int '1234567' ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string s = "123456789"; int res = std::strtol(s.c_str(), 0, 10);_mean 27.9 ns 27.9 ns 4
|
||||
std::string s = "123456789"; int res = std::strtol(s.c_str(), 0, 10);_median 27.9 ns 27.9 ns 4
|
||||
std::string s = "123456789"; int res = std::strtol(s.c_str(), 0, 10);_stddev 0.402 ns 0.402 ns 4
|
||||
std::string s = "123456789"; int res = std::strtol(s.c_str(), 0, 10);_cv 1.44 % 1.44 % 4
|
||||
std::string_view s = "123456789"; std::from_chars(s.data(), s.data() + s.size(), res, 10);_mean 12.5 ns 12.5 ns 4
|
||||
std::string_view s = "123456789"; std::from_chars(s.data(), s.data() + s.size(), res, 10);_median 12.3 ns 12.3 ns 4
|
||||
std::string_view s = "123456789"; std::from_chars(s.data(), s.data() + s.size(), res, 10);_stddev 0.396 ns 0.396 ns 4
|
||||
std::string_view s = "123456789"; std::from_chars(s.data(), s.data() + s.size(), res, 10);_cv 3.17 % 3.17 % 4
|
||||
stringa s = "123456789"; int res = s.to_int<int, true, 10, false>_mean 16.8 ns 16.8 ns 4
|
||||
stringa s = "123456789"; int res = s.to_int<int, true, 10, false>_median 16.8 ns 16.8 ns 4
|
||||
stringa s = "123456789"; int res = s.to_int<int, true, 10, false>_stddev 0.196 ns 0.196 ns 4
|
||||
stringa s = "123456789"; int res = s.to_int<int, true, 10, false>_cv 1.16 % 1.16 % 4
|
||||
ssa s = "123456789"; int res = s.to_int<int, true, 10, false>_mean 7.54 ns 7.54 ns 4
|
||||
ssa s = "123456789"; int res = s.to_int<int, true, 10, false>_median 7.55 ns 7.55 ns 4
|
||||
ssa s = "123456789"; int res = s.to_int<int, true, 10, false>_stddev 0.041 ns 0.041 ns 4
|
||||
ssa s = "123456789"; int res = s.to_int<int, true, 10, false>_cv 0.55 % 0.55 % 4
|
||||
lstringa<20> s = "123456789"; int res = s.to_int<int, true, 10, false>_mean 8.43 ns 8.43 ns 4
|
||||
lstringa<20> s = "123456789"; int res = s.to_int<int, true, 10, false>_median 8.42 ns 8.42 ns 4
|
||||
lstringa<20> s = "123456789"; int res = s.to_int<int, true, 10, false>_stddev 0.141 ns 0.141 ns 4
|
||||
lstringa<20> s = "123456789"; int res = s.to_int<int, true, 10, false>_cv 1.68 % 1.68 % 4
|
||||
----- Convert to unsigned 'abcDef' ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string s = "abcDef"; int res = std::strtol(s.c_str(), 0, 16);_mean 23.9 ns 23.9 ns 4
|
||||
std::string s = "abcDef"; int res = std::strtol(s.c_str(), 0, 16);_median 23.9 ns 23.9 ns 4
|
||||
std::string s = "abcDef"; int res = std::strtol(s.c_str(), 0, 16);_stddev 0.614 ns 0.614 ns 4
|
||||
std::string s = "abcDef"; int res = std::strtol(s.c_str(), 0, 16);_cv 2.58 % 2.58 % 4
|
||||
std::string_view s = "abcDef"; std::from_chars(s.data(), s.data() + s.size(), res, 16);_mean 9.15 ns 9.15 ns 4
|
||||
std::string_view s = "abcDef"; std::from_chars(s.data(), s.data() + s.size(), res, 16);_median 9.19 ns 9.19 ns 4
|
||||
std::string_view s = "abcDef"; std::from_chars(s.data(), s.data() + s.size(), res, 16);_stddev 0.181 ns 0.181 ns 4
|
||||
std::string_view s = "abcDef"; std::from_chars(s.data(), s.data() + s.size(), res, 16);_cv 1.98 % 1.98 % 4
|
||||
stringa s = "abcDef"; int res = s.to_int<int, true, 16, false>_mean 16.2 ns 16.2 ns 4
|
||||
stringa s = "abcDef"; int res = s.to_int<int, true, 16, false>_median 16.3 ns 16.3 ns 4
|
||||
stringa s = "abcDef"; int res = s.to_int<int, true, 16, false>_stddev 0.118 ns 0.118 ns 4
|
||||
stringa s = "abcDef"; int res = s.to_int<int, true, 16, false>_cv 0.73 % 0.73 % 4
|
||||
ssa s = "abcDef"; int res = s.to_int<int, true, 16, false>_mean 6.48 ns 6.48 ns 4
|
||||
ssa s = "abcDef"; int res = s.to_int<int, true, 16, false>_median 6.45 ns 6.45 ns 4
|
||||
ssa s = "abcDef"; int res = s.to_int<int, true, 16, false>_stddev 0.151 ns 0.151 ns 4
|
||||
ssa s = "abcDef"; int res = s.to_int<int, true, 16, false>_cv 2.32 % 2.32 % 4
|
||||
lstringa<20> s = "abcDef"; int res = s.to_int<int, true, 16, false>_mean 6.42 ns 6.42 ns 4
|
||||
lstringa<20> s = "abcDef"; int res = s.to_int<int, true, 16, false>_median 6.43 ns 6.43 ns 4
|
||||
lstringa<20> s = "abcDef"; int res = s.to_int<int, true, 16, false>_stddev 0.128 ns 0.128 ns 4
|
||||
lstringa<20> s = "abcDef"; int res = s.to_int<int, true, 16, false>_cv 1.99 % 1.99 % 4
|
||||
----- Convert to int ' 1234567' ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string s = " 123456789"; int res = std::strtol(s.c_str(), 0, 0);_mean 29.1 ns 29.1 ns 4
|
||||
std::string s = " 123456789"; int res = std::strtol(s.c_str(), 0, 0);_median 29.1 ns 29.1 ns 4
|
||||
std::string s = " 123456789"; int res = std::strtol(s.c_str(), 0, 0);_stddev 0.141 ns 0.141 ns 4
|
||||
std::string s = " 123456789"; int res = std::strtol(s.c_str(), 0, 0);_cv 0.49 % 0.49 % 4
|
||||
stringa s = " 123456789"; int res = s.to_int<int>; // Check overflow_mean 23.8 ns 23.8 ns 4
|
||||
stringa s = " 123456789"; int res = s.to_int<int>; // Check overflow_median 23.7 ns 23.7 ns 4
|
||||
stringa s = " 123456789"; int res = s.to_int<int>; // Check overflow_stddev 0.203 ns 0.203 ns 4
|
||||
stringa s = " 123456789"; int res = s.to_int<int>; // Check overflow_cv 0.85 % 0.85 % 4
|
||||
ssa s = " 123456789"; int res = s.to_int<int, false>; // No check overflow_mean 11.0 ns 11.0 ns 4
|
||||
ssa s = " 123456789"; int res = s.to_int<int, false>; // No check overflow_median 11.1 ns 11.1 ns 4
|
||||
ssa s = " 123456789"; int res = s.to_int<int, false>; // No check overflow_stddev 0.156 ns 0.156 ns 4
|
||||
ssa s = " 123456789"; int res = s.to_int<int, false>; // No check overflow_cv 1.41 % 1.41 % 4
|
||||
----- Convert to double '1234.567e10' ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string s = "1234.567e10"; double res = std::strtod(s.c_str(), nullptr);_mean 66.3 ns 66.3 ns 4
|
||||
std::string s = "1234.567e10"; double res = std::strtod(s.c_str(), nullptr);_median 66.2 ns 66.2 ns 4
|
||||
std::string s = "1234.567e10"; double res = std::strtod(s.c_str(), nullptr);_stddev 0.163 ns 0.163 ns 4
|
||||
std::string s = "1234.567e10"; double res = std::strtod(s.c_str(), nullptr);_cv 0.25 % 0.25 % 4
|
||||
std::string_view s = "1234.567e10"; std::from_chars(s.data(), s.data() + s.size(), res);_mean 24.4 ns 24.4 ns 4
|
||||
std::string_view s = "1234.567e10"; std::from_chars(s.data(), s.data() + s.size(), res);_median 24.2 ns 24.2 ns 4
|
||||
std::string_view s = "1234.567e10"; std::from_chars(s.data(), s.data() + s.size(), res);_stddev 0.303 ns 0.303 ns 4
|
||||
std::string_view s = "1234.567e10"; std::from_chars(s.data(), s.data() + s.size(), res);_cv 1.24 % 1.24 % 4
|
||||
ssa s = "1234.567e10"; double res = *s.to_double()_mean 24.5 ns 24.5 ns 4
|
||||
ssa s = "1234.567e10"; double res = *s.to_double()_median 24.5 ns 24.5 ns 4
|
||||
ssa s = "1234.567e10"; double res = *s.to_double()_stddev 0.380 ns 0.380 ns 4
|
||||
ssa s = "1234.567e10"; double res = *s.to_double()_cv 1.55 % 1.55 % 4
|
||||
-- Append const literal of 16 bytes 64 times, 1024 total length --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::stringstream str; ... str << "abbaabbaabbaabba";_mean 1411 ns 1411 ns 4
|
||||
std::stringstream str; ... str << "abbaabbaabbaabba";_median 1412 ns 1412 ns 4
|
||||
std::stringstream str; ... str << "abbaabbaabbaabba";_stddev 35.0 ns 35.0 ns 4
|
||||
std::stringstream str; ... str << "abbaabbaabbaabba";_cv 2.48 % 2.48 % 4
|
||||
std::string str; ... str += "abbaabbaabbaabba";_mean 380 ns 380 ns 4
|
||||
std::string str; ... str += "abbaabbaabbaabba";_median 380 ns 380 ns 4
|
||||
std::string str; ... str += "abbaabbaabbaabba";_stddev 9.10 ns 9.10 ns 4
|
||||
std::string str; ... str += "abbaabbaabbaabba";_cv 2.40 % 2.40 % 4
|
||||
lstringa<8> str; ... str += "abbaabbaabbaabba";_mean 364 ns 364 ns 4
|
||||
lstringa<8> str; ... str += "abbaabbaabbaabba";_median 365 ns 365 ns 4
|
||||
lstringa<8> str; ... str += "abbaabbaabbaabba";_stddev 7.15 ns 7.14 ns 4
|
||||
lstringa<8> str; ... str += "abbaabbaabbaabba";_cv 1.96 % 1.96 % 4
|
||||
lstringa<128> str; ... str += "abbaabbaabbaabba";_mean 271 ns 271 ns 4
|
||||
lstringa<128> str; ... str += "abbaabbaabbaabba";_median 274 ns 274 ns 4
|
||||
lstringa<128> str; ... str += "abbaabbaabbaabba";_stddev 11.8 ns 11.8 ns 4
|
||||
lstringa<128> str; ... str += "abbaabbaabbaabba";_cv 4.35 % 4.35 % 4
|
||||
lstringa<512> str; ... str += "abbaabbaabbaabba";_mean 229 ns 229 ns 4
|
||||
lstringa<512> str; ... str += "abbaabbaabbaabba";_median 233 ns 233 ns 4
|
||||
lstringa<512> str; ... str += "abbaabbaabbaabba";_stddev 8.90 ns 8.90 ns 4
|
||||
lstringa<512> str; ... str += "abbaabbaabbaabba";_cv 3.89 % 3.89 % 4
|
||||
lstringa<1024> str; ... str += "abbaabbaabbaabba";_mean 144 ns 144 ns 4
|
||||
lstringa<1024> str; ... str += "abbaabbaabbaabba";_median 144 ns 144 ns 4
|
||||
lstringa<1024> str; ... str += "abbaabbaabbaabba";_stddev 1.68 ns 1.68 ns 4
|
||||
lstringa<1024> str; ... str += "abbaabbaabbaabba";_cv 1.17 % 1.17 % 4
|
||||
-- Append string of 16 bytes and const literal of 16 bytes 32 times, 1024 total length --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba";_mean 1391 ns 1391 ns 4
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba";_median 1393 ns 1393 ns 4
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba";_stddev 6.61 ns 6.60 ns 4
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba";_cv 0.48 % 0.47 % 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba";_mean 1161 ns 1161 ns 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba";_median 1163 ns 1163 ns 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba";_stddev 17.5 ns 17.5 ns 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba";_cv 1.51 % 1.51 % 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba";_mean 443 ns 443 ns 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba";_median 443 ns 443 ns 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba";_stddev 6.52 ns 6.52 ns 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba";_cv 1.47 % 1.47 % 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba";_mean 368 ns 368 ns 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba";_median 369 ns 369 ns 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba";_stddev 12.5 ns 12.5 ns 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba";_cv 3.41 % 3.41 % 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba";_mean 348 ns 348 ns 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba";_median 354 ns 354 ns 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba";_stddev 17.3 ns 17.3 ns 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba";_cv 4.98 % 4.98 % 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba";_mean 214 ns 214 ns 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba";_median 215 ns 215 ns 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba";_stddev 3.03 ns 3.03 ns 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba";_cv 1.41 % 1.41 % 4
|
||||
-- Append string of 16 bytes and const literal of 16 bytes 2048 times, 65536 total length --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba"; 2048 times_mean 75407 ns 75407 ns 4
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba"; 2048 times_median 76071 ns 76071 ns 4
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba"; 2048 times_stddev 1624 ns 1624 ns 4
|
||||
std::stringstream str; ... str << str_var << "abbaabbaabbaabba"; 2048 times_cv 2.15 % 2.15 % 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_mean 67303 ns 67303 ns 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_median 67374 ns 67374 ns 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_stddev 747 ns 747 ns 4
|
||||
std::string str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_cv 1.11 % 1.11 % 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_mean 20392 ns 20392 ns 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_median 20416 ns 20416 ns 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_stddev 93.8 ns 93.8 ns 4
|
||||
lstringa<8> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_cv 0.46 % 0.46 % 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_mean 17950 ns 17950 ns 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_median 18065 ns 18065 ns 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_stddev 352 ns 352 ns 4
|
||||
lstringa<128> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_cv 1.96 % 1.96 % 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_mean 17908 ns 17908 ns 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_median 17973 ns 17972 ns 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_stddev 436 ns 436 ns 4
|
||||
lstringa<512> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_cv 2.44 % 2.44 % 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_mean 17735 ns 17735 ns 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_median 17771 ns 17771 ns 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_stddev 347 ns 347 ns 4
|
||||
lstringa<1024> str; ... str += str_var + "abbaabbaabbaabba"; 2048 times_cv 1.95 % 1.95 % 4
|
||||
-- Append 2 string of 16 bytes 32 times, 1024 total length --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::stringstream str; ... str << str_var1 << str_var2;_mean 1397 ns 1397 ns 4
|
||||
std::stringstream str; ... str << str_var1 << str_var2;_median 1392 ns 1392 ns 4
|
||||
std::stringstream str; ... str << str_var1 << str_var2;_stddev 41.3 ns 41.3 ns 4
|
||||
std::stringstream str; ... str << str_var1 << str_var2;_cv 2.95 % 2.95 % 4
|
||||
std::string str; ... str += str_var1 + str_var2;_mean 1344 ns 1344 ns 4
|
||||
std::string str; ... str += str_var1 + str_var2;_median 1332 ns 1332 ns 4
|
||||
std::string str; ... str += str_var1 + str_var2;_stddev 64.6 ns 64.6 ns 4
|
||||
std::string str; ... str += str_var1 + str_var2;_cv 4.81 % 4.81 % 4
|
||||
lstringa<16> str; ... str += str_var1 + str_var2;_mean 547 ns 547 ns 4
|
||||
lstringa<16> str; ... str += str_var1 + str_var2;_median 551 ns 551 ns 4
|
||||
lstringa<16> str; ... str += str_var1 + str_var2;_stddev 9.05 ns 9.05 ns 4
|
||||
lstringa<16> str; ... str += str_var1 + str_var2;_cv 1.65 % 1.65 % 4
|
||||
lstringa<128> str; ... str += str_var1 + str_var2;_mean 454 ns 454 ns 4
|
||||
lstringa<128> str; ... str += str_var1 + str_var2;_median 457 ns 457 ns 4
|
||||
lstringa<128> str; ... str += str_var1 + str_var2;_stddev 12.0 ns 12.0 ns 4
|
||||
lstringa<128> str; ... str += str_var1 + str_var2;_cv 2.64 % 2.64 % 4
|
||||
lstringa<512> str; ... str += str_var1 + str_var2;_mean 422 ns 422 ns 4
|
||||
lstringa<512> str; ... str += str_var1 + str_var2;_median 426 ns 426 ns 4
|
||||
lstringa<512> str; ... str += str_var1 + str_var2;_stddev 25.1 ns 25.1 ns 4
|
||||
lstringa<512> str; ... str += str_var1 + str_var2;_cv 5.95 % 5.95 % 4
|
||||
lstringa<1024> str; ... str += str_var1 + str_var2;_mean 310 ns 310 ns 4
|
||||
lstringa<1024> str; ... str += str_var1 + str_var2;_median 311 ns 311 ns 4
|
||||
lstringa<1024> str; ... str += str_var1 + str_var2;_stddev 6.36 ns 6.36 ns 4
|
||||
lstringa<1024> str; ... str += str_var1 + str_var2;_cv 2.05 % 2.05 % 4
|
||||
-- Append text, number, text --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::stringstream str; str << "test = " << k << " times";_mean 3033 ns 3033 ns 4
|
||||
std::stringstream str; str << "test = " << k << " times";_median 3046 ns 3046 ns 4
|
||||
std::stringstream str; str << "test = " << k << " times";_stddev 70.7 ns 70.7 ns 4
|
||||
std::stringstream str; str << "test = " << k << " times";_cv 2.33 % 2.33 % 4
|
||||
std::string str = "test = " + std::to_string(k) + " times";_mean 427 ns 427 ns 4
|
||||
std::string str = "test = " + std::to_string(k) + " times";_median 426 ns 426 ns 4
|
||||
std::string str = "test = " + std::to_string(k) + " times";_stddev 5.62 ns 5.61 ns 4
|
||||
std::string str = "test = " + std::to_string(k) + " times";_cv 1.32 % 1.32 % 4
|
||||
char buf[100]; sprintf(buf, "test = %u times", k); std::string str = buf;_mean 1487 ns 1487 ns 4
|
||||
char buf[100]; sprintf(buf, "test = %u times", k); std::string str = buf;_median 1478 ns 1478 ns 4
|
||||
char buf[100]; sprintf(buf, "test = %u times", k); std::string str = buf;_stddev 26.4 ns 26.4 ns 4
|
||||
char buf[100]; sprintf(buf, "test = %u times", k); std::string str = buf;_cv 1.78 % 1.78 % 4
|
||||
std::string str = std::format("test = {} times", k);_mean 1206 ns 1206 ns 4
|
||||
std::string str = std::format("test = {} times", k);_median 1196 ns 1196 ns 4
|
||||
std::string str = std::format("test = {} times", k);_stddev 34.6 ns 34.6 ns 4
|
||||
std::string str = std::format("test = {} times", k);_cv 2.87 % 2.87 % 4
|
||||
lstringa<8> str; str.format("test = {} times", k);_mean 1559 ns 1559 ns 4
|
||||
lstringa<8> str; str.format("test = {} times", k);_median 1553 ns 1553 ns 4
|
||||
lstringa<8> str; str.format("test = {} times", k);_stddev 41.0 ns 41.0 ns 4
|
||||
lstringa<8> str; str.format("test = {} times", k);_cv 2.63 % 2.63 % 4
|
||||
lstringa<32> str; str.format("test = {} times", k);_mean 1054 ns 1054 ns 4
|
||||
lstringa<32> str; str.format("test = {} times", k);_median 1047 ns 1047 ns 4
|
||||
lstringa<32> str; str.format("test = {} times", k);_stddev 16.7 ns 16.7 ns 4
|
||||
lstringa<32> str; str.format("test = {} times", k);_cv 1.58 % 1.58 % 4
|
||||
lstringa<8> str = "test = " + k + " times";_mean 290 ns 290 ns 4
|
||||
lstringa<8> str = "test = " + k + " times";_median 289 ns 289 ns 4
|
||||
lstringa<8> str = "test = " + k + " times";_stddev 3.95 ns 3.95 ns 4
|
||||
lstringa<8> str = "test = " + k + " times";_cv 1.36 % 1.36 % 4
|
||||
lstringa<32> str = "test = " + k + " times";_mean 136 ns 136 ns 4
|
||||
lstringa<32> str = "test = " + k + " times";_median 136 ns 136 ns 4
|
||||
lstringa<32> str = "test = " + k + " times";_stddev 2.69 ns 2.69 ns 4
|
||||
lstringa<32> str = "test = " + k + " times";_cv 1.98 % 1.98 % 4
|
||||
stringa str = "test = " + k + " times";_mean 137 ns 137 ns 4
|
||||
stringa str = "test = " + k + " times";_median 138 ns 138 ns 4
|
||||
stringa str = "test = " + k + " times";_stddev 2.86 ns 2.86 ns 4
|
||||
stringa str = "test = " + k + " times";_cv 2.09 % 2.09 % 4
|
||||
-- Split text and convert to int --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
std::string::find + substr + std::strtol_mean 275 ns 275 ns 4
|
||||
std::string::find + substr + std::strtol_median 276 ns 276 ns 4
|
||||
std::string::find + substr + std::strtol_stddev 7.55 ns 7.55 ns 4
|
||||
std::string::find + substr + std::strtol_cv 2.74 % 2.74 % 4
|
||||
ssa::splitter + ssa::as_int_mean 192 ns 192 ns 4
|
||||
ssa::splitter + ssa::as_int_median 192 ns 192 ns 4
|
||||
ssa::splitter + ssa::as_int_stddev 3.46 ns 3.46 ns 4
|
||||
ssa::splitter + ssa::as_int_cv 1.80 % 1.80 % 4
|
||||
ssa::splitf + functor_mean 196 ns 196 ns 4
|
||||
ssa::splitf + functor_median 196 ns 196 ns 4
|
||||
ssa::splitf + functor_stddev 0.580 ns 0.580 ns 4
|
||||
ssa::splitf + functor_cv 0.30 % 0.30 % 4
|
||||
-- Replace symbols in text ~400 symbols --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Naive (and wrong) replace symbols with std::string find + replace_mean 822 ns 822 ns 4
|
||||
Naive (and wrong) replace symbols with std::string find + replace_median 821 ns 821 ns 4
|
||||
Naive (and wrong) replace symbols with std::string find + replace_stddev 19.8 ns 19.8 ns 4
|
||||
Naive (and wrong) replace symbols with std::string find + replace_cv 2.41 % 2.41 % 4
|
||||
replace symbols with std::string find_first_of + replace_mean 2428 ns 2428 ns 4
|
||||
replace symbols with std::string find_first_of + replace_median 2424 ns 2424 ns 4
|
||||
replace symbols with std::string find_first_of + replace_stddev 88.6 ns 88.6 ns 4
|
||||
replace symbols with std::string find_first_of + replace_cv 3.65 % 3.65 % 4
|
||||
replace symbols with std::string_view find_first_of + copy_mean 1065 ns 1065 ns 4
|
||||
replace symbols with std::string_view find_first_of + copy_median 1062 ns 1062 ns 4
|
||||
replace symbols with std::string_view find_first_of + copy_stddev 18.7 ns 18.7 ns 4
|
||||
replace symbols with std::string_view find_first_of + copy_cv 1.76 % 1.76 % 4
|
||||
replace runtime symbols with string expressions and without remembering all search results_mean 1372 ns 1372 ns 4
|
||||
replace runtime symbols with string expressions and without remembering all search results_median 1363 ns 1363 ns 4
|
||||
replace runtime symbols with string expressions and without remembering all search results_stddev 28.6 ns 28.6 ns 4
|
||||
replace runtime symbols with string expressions and without remembering all search results_cv 2.09 % 2.09 % 4
|
||||
replace runtime symbols with simstr and memorization of all search results_mean 1016 ns 1016 ns 4
|
||||
replace runtime symbols with simstr and memorization of all search results_median 1011 ns 1011 ns 4
|
||||
replace runtime symbols with simstr and memorization of all search results_stddev 19.6 ns 19.6 ns 4
|
||||
replace runtime symbols with simstr and memorization of all search results_cv 1.93 % 1.93 % 4
|
||||
replace const symbols with string expressions and without remembering all search results_mean 1045 ns 1045 ns 4
|
||||
replace const symbols with string expressions and without remembering all search results_median 1039 ns 1039 ns 4
|
||||
replace const symbols with string expressions and without remembering all search results_stddev 35.5 ns 35.5 ns 4
|
||||
replace const symbols with string expressions and without remembering all search results_cv 3.40 % 3.40 % 4
|
||||
replace const symbols with string expressions and memorization of all search results_mean 837 ns 837 ns 4
|
||||
replace const symbols with string expressions and memorization of all search results_median 842 ns 842 ns 4
|
||||
replace const symbols with string expressions and memorization of all search results_stddev 17.2 ns 17.2 ns 4
|
||||
replace const symbols with string expressions and memorization of all search results_cv 2.06 % 2.06 % 4
|
||||
-- Replace symbols in text ~40 symbols --/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Short Naive (and wrong) replace symbols with std::string find + replace_mean 161 ns 161 ns 4
|
||||
Short Naive (and wrong) replace symbols with std::string find + replace_median 161 ns 161 ns 4
|
||||
Short Naive (and wrong) replace symbols with std::string find + replace_stddev 2.20 ns 2.20 ns 4
|
||||
Short Naive (and wrong) replace symbols with std::string find + replace_cv 1.36 % 1.36 % 4
|
||||
Short replace symbols with std::string find_first_of + replace_mean 329 ns 329 ns 4
|
||||
Short replace symbols with std::string find_first_of + replace_median 329 ns 329 ns 4
|
||||
Short replace symbols with std::string find_first_of + replace_stddev 8.06 ns 8.06 ns 4
|
||||
Short replace symbols with std::string find_first_of + replace_cv 2.45 % 2.45 % 4
|
||||
Short replace symbols with std::string_view find_first_of + copy_mean 154 ns 154 ns 4
|
||||
Short replace symbols with std::string_view find_first_of + copy_median 153 ns 153 ns 4
|
||||
Short replace symbols with std::string_view find_first_of + copy_stddev 5.45 ns 5.45 ns 4
|
||||
Short replace symbols with std::string_view find_first_of + copy_cv 3.55 % 3.55 % 4
|
||||
Short replace runtime symbols with string expressions and without remembering all search results_mean 180 ns 180 ns 4
|
||||
Short replace runtime symbols with string expressions and without remembering all search results_median 179 ns 179 ns 4
|
||||
Short replace runtime symbols with string expressions and without remembering all search results_stddev 4.51 ns 4.51 ns 4
|
||||
Short replace runtime symbols with string expressions and without remembering all search results_cv 2.50 % 2.50 % 4
|
||||
Short replace runtime symbols with simstr and memorization of all search results_mean 184 ns 184 ns 4
|
||||
Short replace runtime symbols with simstr and memorization of all search results_median 184 ns 184 ns 4
|
||||
Short replace runtime symbols with simstr and memorization of all search results_stddev 2.95 ns 2.95 ns 4
|
||||
Short replace runtime symbols with simstr and memorization of all search results_cv 1.61 % 1.61 % 4
|
||||
Short replace const symbols with string expressions and without remembering all search results_mean 139 ns 139 ns 4
|
||||
Short replace const symbols with string expressions and without remembering all search results_median 139 ns 139 ns 4
|
||||
Short replace const symbols with string expressions and without remembering all search results_stddev 1.27 ns 1.27 ns 4
|
||||
Short replace const symbols with string expressions and without remembering all search results_cv 0.91 % 0.91 % 4
|
||||
Short replace const symbols with string expressions and memorization of all search results_mean 132 ns 132 ns 4
|
||||
Short replace const symbols with string expressions and memorization of all search results_median 132 ns 132 ns 4
|
||||
Short replace const symbols with string expressions and memorization of all search results_stddev 1.26 ns 1.26 ns 4
|
||||
Short replace const symbols with string expressions and memorization of all search results_cv 0.95 % 0.95 % 4
|
||||
----- Replace All Str To Longer Size ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
replace bb to ---- in std::string|64_mean 154 ns 154 ns 4
|
||||
replace bb to ---- in std::string|64_median 154 ns 154 ns 4
|
||||
replace bb to ---- in std::string|64_stddev 1.72 ns 1.72 ns 4
|
||||
replace bb to ---- in std::string|64_cv 1.11 % 1.11 % 4
|
||||
replace bb to ---- in std::string|256_mean 504 ns 504 ns 4
|
||||
replace bb to ---- in std::string|256_median 504 ns 504 ns 4
|
||||
replace bb to ---- in std::string|256_stddev 18.2 ns 18.2 ns 4
|
||||
replace bb to ---- in std::string|256_cv 3.62 % 3.62 % 4
|
||||
replace bb to ---- in std::string|512_mean 1000 ns 1000 ns 4
|
||||
replace bb to ---- in std::string|512_median 1002 ns 1002 ns 4
|
||||
replace bb to ---- in std::string|512_stddev 17.0 ns 17.0 ns 4
|
||||
replace bb to ---- in std::string|512_cv 1.70 % 1.70 % 4
|
||||
replace bb to ---- in std::string|1024_mean 2347 ns 2347 ns 4
|
||||
replace bb to ---- in std::string|1024_median 2324 ns 2324 ns 4
|
||||
replace bb to ---- in std::string|1024_stddev 166 ns 166 ns 4
|
||||
replace bb to ---- in std::string|1024_cv 7.05 % 7.05 % 4
|
||||
replace bb to ---- in std::string|2048_mean 5969 ns 5969 ns 4
|
||||
replace bb to ---- in std::string|2048_median 5919 ns 5919 ns 4
|
||||
replace bb to ---- in std::string|2048_stddev 266 ns 266 ns 4
|
||||
replace bb to ---- in std::string|2048_cv 4.46 % 4.46 % 4
|
||||
replace bb to ---- in lstringa<8>|64_mean 138 ns 138 ns 4
|
||||
replace bb to ---- in lstringa<8>|64_median 139 ns 139 ns 4
|
||||
replace bb to ---- in lstringa<8>|64_stddev 3.50 ns 3.50 ns 4
|
||||
replace bb to ---- in lstringa<8>|64_cv 2.53 % 2.53 % 4
|
||||
replace bb to ---- in lstringa<8>|256_mean 444 ns 444 ns 4
|
||||
replace bb to ---- in lstringa<8>|256_median 447 ns 447 ns 4
|
||||
replace bb to ---- in lstringa<8>|256_stddev 6.19 ns 6.19 ns 4
|
||||
replace bb to ---- in lstringa<8>|256_cv 1.39 % 1.39 % 4
|
||||
replace bb to ---- in lstringa<8>|512_mean 899 ns 899 ns 4
|
||||
replace bb to ---- in lstringa<8>|512_median 896 ns 896 ns 4
|
||||
replace bb to ---- in lstringa<8>|512_stddev 19.6 ns 19.6 ns 4
|
||||
replace bb to ---- in lstringa<8>|512_cv 2.18 % 2.18 % 4
|
||||
replace bb to ---- in lstringa<8>|1024_mean 1751 ns 1751 ns 4
|
||||
replace bb to ---- in lstringa<8>|1024_median 1752 ns 1752 ns 4
|
||||
replace bb to ---- in lstringa<8>|1024_stddev 11.7 ns 11.7 ns 4
|
||||
replace bb to ---- in lstringa<8>|1024_cv 0.67 % 0.67 % 4
|
||||
replace bb to ---- in lstringa<8>|2048_mean 3301 ns 3301 ns 4
|
||||
replace bb to ---- in lstringa<8>|2048_median 3294 ns 3294 ns 4
|
||||
replace bb to ---- in lstringa<8>|2048_stddev 81.9 ns 81.9 ns 4
|
||||
replace bb to ---- in lstringa<8>|2048_cv 2.48 % 2.48 % 4
|
||||
replace bb to ---- by init stringa|64_mean 92.8 ns 92.8 ns 4
|
||||
replace bb to ---- by init stringa|64_median 92.6 ns 92.6 ns 4
|
||||
replace bb to ---- by init stringa|64_stddev 1.37 ns 1.37 ns 4
|
||||
replace bb to ---- by init stringa|64_cv 1.48 % 1.48 % 4
|
||||
replace bb to ---- by init stringa|256_mean 287 ns 288 ns 4
|
||||
replace bb to ---- by init stringa|256_median 287 ns 287 ns 4
|
||||
replace bb to ---- by init stringa|256_stddev 1.86 ns 1.86 ns 4
|
||||
replace bb to ---- by init stringa|256_cv 0.65 % 0.65 % 4
|
||||
replace bb to ---- by init stringa|512_mean 705 ns 705 ns 4
|
||||
replace bb to ---- by init stringa|512_median 702 ns 702 ns 4
|
||||
replace bb to ---- by init stringa|512_stddev 12.7 ns 12.7 ns 4
|
||||
replace bb to ---- by init stringa|512_cv 1.79 % 1.79 % 4
|
||||
replace bb to ---- by init stringa|1024_mean 1550 ns 1550 ns 4
|
||||
replace bb to ---- by init stringa|1024_median 1543 ns 1543 ns 4
|
||||
replace bb to ---- by init stringa|1024_stddev 19.4 ns 19.4 ns 4
|
||||
replace bb to ---- by init stringa|1024_cv 1.25 % 1.25 % 4
|
||||
replace bb to ---- by init stringa|2048_mean 3106 ns 3106 ns 4
|
||||
replace bb to ---- by init stringa|2048_median 3111 ns 3111 ns 4
|
||||
replace bb to ---- by init stringa|2048_stddev 20.5 ns 20.4 ns 4
|
||||
replace bb to ---- by init stringa|2048_cv 0.66 % 0.66 % 4
|
||||
----- Replace All Str To Same Size ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
replace bb to -- in std::string|64_mean 131 ns 131 ns 4
|
||||
replace bb to -- in std::string|64_median 129 ns 129 ns 4
|
||||
replace bb to -- in std::string|64_stddev 4.51 ns 4.51 ns 4
|
||||
replace bb to -- in std::string|64_cv 3.45 % 3.45 % 4
|
||||
replace bb to -- in std::string|256_mean 381 ns 381 ns 4
|
||||
replace bb to -- in std::string|256_median 381 ns 381 ns 4
|
||||
replace bb to -- in std::string|256_stddev 5.71 ns 5.71 ns 4
|
||||
replace bb to -- in std::string|256_cv 1.50 % 1.50 % 4
|
||||
replace bb to -- in std::string|512_mean 743 ns 743 ns 4
|
||||
replace bb to -- in std::string|512_median 744 ns 744 ns 4
|
||||
replace bb to -- in std::string|512_stddev 6.19 ns 6.19 ns 4
|
||||
replace bb to -- in std::string|512_cv 0.83 % 0.83 % 4
|
||||
replace bb to -- in std::string|1024_mean 1483 ns 1483 ns 4
|
||||
replace bb to -- in std::string|1024_median 1477 ns 1477 ns 4
|
||||
replace bb to -- in std::string|1024_stddev 36.1 ns 36.1 ns 4
|
||||
replace bb to -- in std::string|1024_cv 2.43 % 2.43 % 4
|
||||
replace bb to -- in std::string|2048_mean 2798 ns 2798 ns 4
|
||||
replace bb to -- in std::string|2048_median 2793 ns 2793 ns 4
|
||||
replace bb to -- in std::string|2048_stddev 34.3 ns 34.2 ns 4
|
||||
replace bb to -- in std::string|2048_cv 1.23 % 1.22 % 4
|
||||
replace bb to -- in lstringa<8>|64_mean 91.5 ns 91.5 ns 4
|
||||
replace bb to -- in lstringa<8>|64_median 91.9 ns 91.9 ns 4
|
||||
replace bb to -- in lstringa<8>|64_stddev 2.11 ns 2.11 ns 4
|
||||
replace bb to -- in lstringa<8>|64_cv 2.30 % 2.30 % 4
|
||||
replace bb to -- in lstringa<8>|256_mean 302 ns 302 ns 4
|
||||
replace bb to -- in lstringa<8>|256_median 305 ns 305 ns 4
|
||||
replace bb to -- in lstringa<8>|256_stddev 5.90 ns 5.90 ns 4
|
||||
replace bb to -- in lstringa<8>|256_cv 1.95 % 1.95 % 4
|
||||
replace bb to -- in lstringa<8>|512_mean 539 ns 539 ns 4
|
||||
replace bb to -- in lstringa<8>|512_median 541 ns 541 ns 4
|
||||
replace bb to -- in lstringa<8>|512_stddev 7.25 ns 7.25 ns 4
|
||||
replace bb to -- in lstringa<8>|512_cv 1.34 % 1.34 % 4
|
||||
replace bb to -- in lstringa<8>|1024_mean 1121 ns 1121 ns 4
|
||||
replace bb to -- in lstringa<8>|1024_median 1103 ns 1103 ns 4
|
||||
replace bb to -- in lstringa<8>|1024_stddev 86.3 ns 86.3 ns 4
|
||||
replace bb to -- in lstringa<8>|1024_cv 7.70 % 7.70 % 4
|
||||
replace bb to -- in lstringa<8>|2048_mean 2174 ns 2174 ns 4
|
||||
replace bb to -- in lstringa<8>|2048_median 2126 ns 2126 ns 4
|
||||
replace bb to -- in lstringa<8>|2048_stddev 136 ns 136 ns 4
|
||||
replace bb to -- in lstringa<8>|2048_cv 6.25 % 6.25 % 4
|
||||
replace bb to -- by init stringa|64_mean 112 ns 112 ns 4
|
||||
replace bb to -- by init stringa|64_median 112 ns 112 ns 4
|
||||
replace bb to -- by init stringa|64_stddev 1.35 ns 1.35 ns 4
|
||||
replace bb to -- by init stringa|64_cv 1.20 % 1.20 % 4
|
||||
replace bb to -- by init stringa|256_mean 262 ns 262 ns 4
|
||||
replace bb to -- by init stringa|256_median 262 ns 262 ns 4
|
||||
replace bb to -- by init stringa|256_stddev 3.25 ns 3.25 ns 4
|
||||
replace bb to -- by init stringa|256_cv 1.24 % 1.24 % 4
|
||||
replace bb to -- by init stringa|512_mean 479 ns 479 ns 4
|
||||
replace bb to -- by init stringa|512_median 478 ns 478 ns 4
|
||||
replace bb to -- by init stringa|512_stddev 6.02 ns 6.02 ns 4
|
||||
replace bb to -- by init stringa|512_cv 1.26 % 1.26 % 4
|
||||
replace bb to -- by init stringa|1024_mean 954 ns 954 ns 4
|
||||
replace bb to -- by init stringa|1024_median 953 ns 953 ns 4
|
||||
replace bb to -- by init stringa|1024_stddev 27.7 ns 27.7 ns 4
|
||||
replace bb to -- by init stringa|1024_cv 2.91 % 2.91 % 4
|
||||
replace bb to -- by init stringa|2048_mean 1809 ns 1809 ns 4
|
||||
replace bb to -- by init stringa|2048_median 1804 ns 1804 ns 4
|
||||
replace bb to -- by init stringa|2048_stddev 20.3 ns 20.3 ns 4
|
||||
replace bb to -- by init stringa|2048_cv 1.12 % 1.12 % 4
|
||||
----- Hash Map insert and find ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
hashStrMapA<size_t> emplace & find stringa;_mean 3843202 ns 3843218 ns 4
|
||||
hashStrMapA<size_t> emplace & find stringa;_median 3876351 ns 3876368 ns 4
|
||||
hashStrMapA<size_t> emplace & find stringa;_stddev 83132 ns 83131 ns 4
|
||||
hashStrMapA<size_t> emplace & find stringa;_cv 2.16 % 2.16 % 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string;_mean 3689411 ns 3689422 ns 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string;_median 3701989 ns 3701997 ns 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string;_stddev 102615 ns 102613 ns 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string;_cv 2.78 % 2.78 % 4
|
||||
hashStrMapA<size_t> emplace & find ssa;_mean 3848145 ns 3848147 ns 4
|
||||
hashStrMapA<size_t> emplace & find ssa;_median 3860211 ns 3860203 ns 4
|
||||
hashStrMapA<size_t> emplace & find ssa;_stddev 53550 ns 53545 ns 4
|
||||
hashStrMapA<size_t> emplace & find ssa;_cv 1.39 % 1.39 % 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string_view;_mean 4076242 ns 4076215 ns 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string_view;_median 4075582 ns 4075516 ns 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string_view;_stddev 57080 ns 57087 ns 4
|
||||
std::unordered_map<std::string, size_t> emplace & find std::string_view;_cv 1.40 % 1.40 % 4
|
||||
----- Build Full Func Name ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
Build func full name std::string;_mean 738 ns 738 ns 4
|
||||
Build func full name std::string;_median 745 ns 745 ns 4
|
||||
Build func full name std::string;_stddev 20.2 ns 20.2 ns 4
|
||||
Build func full name std::string;_cv 2.74 % 2.74 % 4
|
||||
Build func full name std::string 1;_mean 820 ns 820 ns 4
|
||||
Build func full name std::string 1;_median 819 ns 819 ns 4
|
||||
Build func full name std::string 1;_stddev 7.48 ns 7.48 ns 4
|
||||
Build func full name std::string 1;_cv 0.91 % 0.91 % 4
|
||||
Build func full name std::stream;_mean 2610 ns 2610 ns 4
|
||||
Build func full name std::stream;_median 2628 ns 2628 ns 4
|
||||
Build func full name std::stream;_stddev 45.5 ns 45.5 ns 4
|
||||
Build func full name std::stream;_cv 1.75 % 1.75 % 4
|
||||
Build func full name stringa;_mean 480 ns 480 ns 4
|
||||
Build func full name stringa;_median 479 ns 479 ns 4
|
||||
Build func full name stringa;_stddev 6.26 ns 6.26 ns 4
|
||||
Build func full name stringa;_cv 1.30 % 1.30 % 4
|
||||
Build func full name stringa 1;_mean 564 ns 564 ns 4
|
||||
Build func full name stringa 1;_median 563 ns 563 ns 4
|
||||
Build func full name stringa 1;_stddev 12.8 ns 12.8 ns 4
|
||||
Build func full name stringa 1;_cv 2.26 % 2.26 % 4
|
||||
----- Make Upper ---------/repeats:1 0.000 ns 0.000 ns 1000000000000
|
||||
To upper case std::wstring_mean 175 ns 175 ns 4
|
||||
To upper case std::wstring_median 174 ns 174 ns 4
|
||||
To upper case std::wstring_stddev 3.12 ns 3.12 ns 4
|
||||
To upper case std::wstring_cv 1.78 % 1.78 % 4
|
||||
To upper case lstringw<15>_mean 40.4 ns 40.4 ns 4
|
||||
To upper case lstringw<15>_median 40.3 ns 40.3 ns 4
|
||||
To upper case lstringw<15>_stddev 0.801 ns 0.801 ns 4
|
||||
To upper case lstringw<15>_cv 1.98 % 1.98 % 4
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -48,7 +48,7 @@ PROJECT_NAME = "simstr"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.6.5
|
||||
PROJECT_NUMBER = 1.9.1
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewers a
|
||||
|
|
@ -2928,7 +2928,7 @@ MAX_DOT_GRAPH_DEPTH = 0
|
|||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.20) support
|
||||
# this, this feature is disabled by default.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ PROJECT_NAME = "simstr"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.6.5
|
||||
PROJECT_NUMBER = 1.9.1
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewers a
|
||||
|
|
@ -2928,7 +2928,7 @@ MAX_DOT_GRAPH_DEPTH = 0
|
|||
|
||||
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||
# makes dot run faster, but since only newer versions of dot (>1.8.20) support
|
||||
# this, this feature is disabled by default.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* ver. 1.6.5
|
||||
* ver. 1.9.1
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
21
readme.md
21
readme.md
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
[](https://github.com/orefkov/simstr/actions/workflows/cmake-multi-platform.yml)
|
||||
|
||||
Version 1.6.5.
|
||||
Version 1.9.1
|
||||
|
||||
<h2>Speed up your work with strings by 2-10 times!</h2>
|
||||
|
||||
|
|
@ -26,13 +26,14 @@ use in my work, trying to do it in the most efficient way, and I modestly hope t
|
|||
and will be useful to other people, either directly or as a source of ideas.
|
||||
|
||||
The library contains two parts:
|
||||
- Implementation of [*"String Expressions"*](https://orefkov.github.io/simstr/docs_ru/overview.html#autotoc_md27) and algorithms for working
|
||||
- Implementation of [*"String Expressions"*](https://orefkov.github.io/simstr/articles/fast_concat.html) and algorithms for working
|
||||
with constant strings.\
|
||||
To use this part, just take the file `"include/simstr/strexpr.h"` and write in your code
|
||||
```cpp
|
||||
#include "path/to file/strexpr.h"
|
||||
```
|
||||
This will allow you to use powerful and fast *"string expressions"* for concatenation and string construction for standard string types (`std::basic_string`, `std::basic_string_view`), as well as simplified versions of the `simple_str` and
|
||||
This will allow you to use powerful and fast *"string expressions"* for concatenation and string construction for standard string types
|
||||
(`std::basic_string`, `std::basic_string_view`), as well as simplified versions of the `simple_str` and
|
||||
`simple_str_nt` classes, which implement all those string algorithms of the library that do not require storing or modifying strings.
|
||||
Since this is a header-only part, it does not include working with UTF encodings and simplified Unicode.
|
||||
- The full version, requiring the connection of the entire library (`"include/simstr/sstring.h"`), adds its string types with
|
||||
|
|
@ -74,13 +75,15 @@ When using only `#include "simstr/strexpr.h"`:
|
|||
for example `str::append(text, "count = "_ss + count)`.
|
||||
- str::replace - replaces occurrences of the search substring with a replacement string or string expression.
|
||||
If the substring is not found, the string expression is not even evaluated.
|
||||
- Parsing integers with the possibility of "fine" tuning at compile time - you can set options for checking overflow,
|
||||
skipping whitespace characters, a specific radix or auto-selection by prefixes `0x`, `0`, `0b`, `0o`,
|
||||
the admissibility of the `+` sign. Parsing is implemented for all types of strings and characters.
|
||||
- Parsing double for `char` and `wchar_t`, as well as character types compatible with them in size.
|
||||
- str::make_ascii_upper, str::make_ascii_lower - change the case of ASCII characters.
|
||||
- Parsing of integers from a "piece of string" (does not require null termination) with the possibility of "fine" tuning during compilation -
|
||||
you can set options for checking for overflow, skipping whitespace characters, a specific radix, or auto-select by
|
||||
prefixes `0x`, `0`, `0b`, `0o`, the `+` sign is allowed. Parsing is implemented for all types of strings and characters.
|
||||
- Parsing double from a "piece of string" for `char` and `char8_t`.
|
||||
|
||||
When using the full version of the library:
|
||||
- Everything that is listed above, plus
|
||||
- Parsing double from a "piece of string" for all types of characters.
|
||||
- Additional efficient string objects - `sstring` (shared string), `lstring` (local string).
|
||||
- `lstring` - supports many mutable operations with strings - various replacements, insertions, deletions, etc.
|
||||
Allows you to set the size for the internal character buffer, which can turn *Small String Optimization* into *Big String Optimization* :).
|
||||
|
|
@ -322,8 +325,8 @@ function(add_simstr)
|
|||
simstr
|
||||
GIT_REPOSITORY https://github.com/orefkov/simstr.git
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_TAG tags/rel1.6.5 # Specify the desired release
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.6.5
|
||||
GIT_TAG tags/rel1.9.1# Specify the desired release
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.9.1
|
||||
)
|
||||
FetchContent_MakeAvailable(simstr)
|
||||
endfunction()
|
||||
|
|
|
|||
19
readme_ru.md
19
readme_ru.md
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
[](https://github.com/orefkov/simstr/actions/workflows/cmake-multi-platform.yml)
|
||||
|
||||
Версия 1.6.5.
|
||||
Версия 1.9.1
|
||||
|
||||
<h2>Ускорь работу со строками в 2-10 раз!</h2>
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
и пригодится другим людям, либо напрямую, либо как источник идей.
|
||||
|
||||
Библиотека содержит две части:
|
||||
- Реализация [*"Строковых выражений"*](https://orefkov.github.io/simstr/docs_ru/overview.html#autotoc_md27) и алгоритмов работы
|
||||
- Реализация [*"Строковых выражений"*](https://orefkov.github.io/simstr/articles/fast_concat_ru.html) и алгоритмов работы
|
||||
с константными строками.\
|
||||
Для использования этой части достаточно просто взять файл `"include/simstr/strexpr.h"` и написать в своём коде
|
||||
```cpp
|
||||
|
|
@ -70,18 +70,21 @@
|
|||
- Слияние (join) контейнеров строк в единую строку, с заданием разделителей и опций - "пропускать пустые", "разделитель после последней".
|
||||
- Разбиение (split) строк на части по заданному разделителю. Разбиение возможно сразу в контейнер со строками, либо вызовом функтора для
|
||||
каждой подстроки, либо путем итерации с помощью итератора `Splitter`.
|
||||
- Создании копии со сменой регистра ASCII символов.
|
||||
- Функции модификации стандартных строк строковыми выражениями:
|
||||
- str::append, str::prepend, str::insert, str::change - меняют str::string строковыми выражениями,
|
||||
например `str::append(text, "count = "_ss + count)`.
|
||||
- str::replace - заменяет вхождения искомой подстроки на строку замены или строковое выражение.
|
||||
Если подстрока не найдена, строковое выражение даже не вычисляется.
|
||||
- Парсинг целых чисел с возможностью "тонкой" настройки при компиляции - можно задавать опции проверки переполнения,
|
||||
пропуск пробельных символов, конкретное основание счисления либо автовыбор по префиксам `0x`, `0`, `0b`, `0o`,
|
||||
допустимость знака `+`. Парсинг реализован для всех видов строк и символов.
|
||||
- Парсинг double для `char` и `wchar_t`, а также совместимых с ними по размеру типов символов.
|
||||
- str::make_ascii_upper, str::make_ascii_lower - смена регистра ASCII символов.
|
||||
- Парсинг целых чисел из "куска строки" (не требует нуль-терминированности) с возможностью "тонкой" настройки при компиляции -
|
||||
можно задавать опции проверки переполнения, пропуск пробельных символов, конкретное основание счисления либо автовыбор по
|
||||
префиксам `0x`, `0`, `0b`, `0o`, допустимость знака `+`. Парсинг реализован для всех видов строк и символов.
|
||||
- Парсинг double из "куска строки" для `char` и `char8_t`.
|
||||
|
||||
При использовании полной версии библиотеки:
|
||||
- Всё то же, что и перечислено выше, плюс
|
||||
- Парсинг double из "куска строки" для всех типов символов.
|
||||
- Дополнительные эффективные строковые объекты - `sstring` (shared string), `lstring` (local string).
|
||||
- `lstring` - поддерживает множество мутабельных операций со строками - различные замены, вставки, удаления и т.п.
|
||||
Позволяет задавать размер для внутреннего буфера символов, что может превращать *Small String Optimization* в *Big String Optimization* :).
|
||||
|
|
@ -323,8 +326,8 @@ function(add_simstr)
|
|||
simstr
|
||||
GIT_REPOSITORY https://github.com/orefkov/simstr.git
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_TAG tags/rel1.6.5 # Укажите нужный релиз
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.6.5
|
||||
GIT_TAG tags/rel1.9.1# Укажите нужный релиз
|
||||
FIND_PACKAGE_ARGS NAMES simstr 1.9.1
|
||||
)
|
||||
FetchContent_MakeAvailable(simstr)
|
||||
endfunction()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.6.5
|
||||
* ver. 1.9.1
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Реализация строковых функций
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
@ -187,6 +187,8 @@ inline u32s makeFoldU(u32s s) {
|
|||
/*
|
||||
* Поиск utf-8 symbols, которые меняют свою длину при upper/lower преобразовании
|
||||
* вот они нашлись
|
||||
* Search for utf-8 codepoints that change their code units length during upper/lower conversion
|
||||
* here they are found
|
||||
* "İiıIſSȺⱥȾⱦɐⱯɑⱭɫⱢɱⱮɽⱤẞßιΙΩωKkÅåⱢɫⱤɽⱥȺⱦȾⱭɑⱮɱⱯɐ"
|
||||
l2u ıI ſS ɐⱯ ɑⱭ ɫⱢ ɱⱮ ɽⱤ ιΙ ⱥȺ ⱦȾ
|
||||
u2l İi Ⱥⱥ Ⱦⱦ ẞß Ωω Kk Åå Ɫɫ Ɽɽ Ɑɑ Ɱɱ Ɐɐ
|
||||
|
|
@ -248,7 +250,7 @@ size_t utf8_case_change(const u8s*& src, size_t len, u8s*& dest, size_t lenBuffe
|
|||
// то есть если символ считан, и длина записываемого символа не больше считанного, то он поместится в буфер записи
|
||||
// и не перетрет символы, которые еще не прочитали
|
||||
// По другому работать откажемся
|
||||
if (lenBuffer < len || (dest > src && dest < src + len))
|
||||
if (dest > src && dest < src + len)
|
||||
return len;
|
||||
const uu8s *beginReadPos = reinterpret_cast<const uu8s*>(src), *readPos = beginReadPos, *endReadPos = beginReadPos + len,
|
||||
*readFromPos = readPos;
|
||||
|
|
@ -386,6 +388,32 @@ SIMSTR_API size_t unicode_traits<u8s>::lower(const u8s*& src, size_t len, u8s*&
|
|||
return utf8_case_change<makeLowerU>(src, len, dest, lenBuffer);
|
||||
}
|
||||
|
||||
SIMSTR_API size_t unicode_traits<u8s>::upper_len(const u8s* src, size_t len) {
|
||||
size_t l = 0;
|
||||
for (const uu8s *ptr = (const uu8s*)src, *start = ptr, *end = ptr + len; ptr < end; start = ptr) {
|
||||
u32s s = readUtf8Symbol(ptr, end), su = makeUpperU(s);
|
||||
if (s == su) {
|
||||
l += ptr - start;
|
||||
} else {
|
||||
l += utf8len(su);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
SIMSTR_API size_t unicode_traits<u8s>::lower_len(const u8s* src, size_t len) {
|
||||
size_t l = 0;
|
||||
for (const uu8s *ptr = (const uu8s*)src, *start = ptr, *end = ptr + len; ptr < end; start = ptr) {
|
||||
u32s s = readUtf8Symbol(ptr, end), su = makeLowerU(s);
|
||||
if (s == su) {
|
||||
l += ptr - start;
|
||||
} else {
|
||||
l += utf8len(su);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
template<auto Op>
|
||||
void utf16_change_case(const u16s* src, size_t len, u16s* dest) {
|
||||
if (dest != src) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.6.5
|
||||
* ver. 1.9.1
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Тесты simstr
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
@ -406,4 +406,68 @@ TEST(StrExpr, EIntFmt) {
|
|||
EXPECT_EQ(test, "0b01100100");
|
||||
}
|
||||
|
||||
TEST(StrExpr, ChangeCase) {
|
||||
std::string res = e_ascii_upper("teSt");
|
||||
EXPECT_EQ(res, "TEST");
|
||||
res = "/" + e_ascii_lower(res) + "/";
|
||||
EXPECT_EQ(res, "/test/");
|
||||
|
||||
EXPECT_EQ(str::make_ascii_upper(res), "/TEST/");
|
||||
|
||||
str::make_ascii_lower(res, 1, 3);
|
||||
EXPECT_EQ(res, "/teST/");
|
||||
|
||||
std::wstring wres = e_ascii_lower(L"TeSt"_ss);
|
||||
EXPECT_EQ(wres, L"test");
|
||||
|
||||
std::u16string ures = u"/test/";
|
||||
EXPECT_EQ(str::make_ascii_upper(ures), u"/TEST/");
|
||||
|
||||
str::make_ascii_lower(ures, 1, 3);
|
||||
EXPECT_EQ(ures, u"/teST/");
|
||||
}
|
||||
|
||||
TEST(StrExpr, StripPrefixSuffix) {
|
||||
const ssa from = "begin--end";
|
||||
EXPECT_EQ(*from.strip_prefix("begin"), "--end");
|
||||
EXPECT_FALSE(from.strip_prefix("sd").has_value());
|
||||
EXPECT_EQ(*from.strip_suffix_ia("End"), "begin--");
|
||||
EXPECT_FALSE(from.strip_suffix("sd").has_value());
|
||||
}
|
||||
|
||||
TEST(StrExpr, TrimPrefixSuffix) {
|
||||
const ssa from = "beginbegin--end";
|
||||
EXPECT_EQ(from.trimmed_prefix("begin"), "--end");
|
||||
EXPECT_EQ(from.trimmed_prefix("begin", 1), "begin--end");
|
||||
EXPECT_EQ(from.trimmed_prefix("sd"), from);
|
||||
EXPECT_EQ(from.trimmed_suffix_ia("End"), "beginbegin--");
|
||||
EXPECT_EQ(from.trimmed_suffix("sd"), from);
|
||||
}
|
||||
|
||||
TEST(StrExpr, StartWithAnd) {
|
||||
EXPECT_TRUE("begin --end"_ss.starts_with_and_ws("begin"));
|
||||
EXPECT_FALSE("beginn --end"_ss.starts_with_and_ws("begin"));
|
||||
EXPECT_TRUE("BegiN\t--end"_ss.starts_with_ia_and_ws("begin"_ss));
|
||||
EXPECT_TRUE("begin[ --end"_ss.starts_with_and_oneof("begin", "/*[]"));
|
||||
EXPECT_TRUE("Begin[ --end"_ss.starts_with_ia_and_oneof("begin", "/*[]"_ss));
|
||||
}
|
||||
|
||||
TEST(SimStr, Get) {
|
||||
ssa testa{"test"};
|
||||
EXPECT_EQ(testa.get(1, to_end), "est");
|
||||
EXPECT_EQ(testa.get(1, 2), "es");
|
||||
EXPECT_EQ(testa.get(1, from_end(1)), "es");
|
||||
EXPECT_EQ(testa.get(1, from_end(10)), "");
|
||||
EXPECT_EQ(testa.get(from_end(3), from_end(1)), "es");
|
||||
|
||||
ssu testu{u"test"};
|
||||
EXPECT_EQ(testu.get(1, to_end), u"est");
|
||||
EXPECT_EQ(testu.get(1, 2), u"es");
|
||||
EXPECT_EQ(testu.get(from_end(3), from_end(1)), u"es");
|
||||
|
||||
ssw testw{L"test"};
|
||||
EXPECT_EQ(testw.get(1, to_end), L"est");
|
||||
EXPECT_EQ(testw.get(1, 2), L"es");
|
||||
EXPECT_EQ(testw.get(from_end(3), from_end(1)), L"es");
|
||||
}
|
||||
} // namespace simstr::tests
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.6.5
|
||||
* ver. 1.9.1
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Тесты simstr
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
@ -24,6 +24,9 @@ public:
|
|||
size_t sharedCount() const {
|
||||
return type_ == Shared ? SharedStringData<u8s>::from_str(sstr_)->ref_.load() : 0u;
|
||||
}
|
||||
size_t sharedCountForce() const {
|
||||
return SharedStringData<u8s>::from_str(sstr_)->ref_.load();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(SimStr, CreateSimpleEmpty) {
|
||||
|
|
@ -271,6 +274,7 @@ TEST(SimStr, SimpleFind) {
|
|||
EXPECT_EQ("abccccc"_ss.find_last("ab"), 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
TEST(SimStr, SubPiece) {
|
||||
ssa testa{"test"};
|
||||
EXPECT_EQ(testa(1), "est");
|
||||
|
|
@ -286,39 +290,83 @@ TEST(SimStr, SubPiece) {
|
|||
EXPECT_EQ(testw(1), L"est");
|
||||
EXPECT_EQ(testw(1, 2), L"es");
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(SimStr, Get) {
|
||||
ssa testa{"test"};
|
||||
EXPECT_EQ(testa.get(1, to_end), "est");
|
||||
EXPECT_EQ(testa.get(1, 2), "es");
|
||||
EXPECT_EQ(testa.get(1, from_end(1)), "es");
|
||||
EXPECT_EQ(testa.get(1, from_end(10)), "");
|
||||
|
||||
ssu testu{u"test"};
|
||||
EXPECT_EQ(testu.get(1, to_end), u"est");
|
||||
EXPECT_EQ(testu.get(1, 2), u"es");
|
||||
|
||||
ssw testw{L"test"};
|
||||
EXPECT_EQ(testw.get(1, to_end), L"est");
|
||||
EXPECT_EQ(testw.get(1, 2), L"es");
|
||||
}
|
||||
|
||||
TEST(SimStr, SimpleSubstr) {
|
||||
ssa testa = "test";
|
||||
#if 0
|
||||
EXPECT_EQ(testa.substr(1, 0), "est");
|
||||
EXPECT_EQ(testa.substr(1, 2), "es");
|
||||
EXPECT_EQ(testa.substr(0, -1), "tes");
|
||||
EXPECT_EQ(testa.substr(-2), "st");
|
||||
EXPECT_EQ(testa.substr(-3, 2), "es");
|
||||
EXPECT_EQ(testa.substr(-3, -1), "es");
|
||||
#endif
|
||||
EXPECT_EQ(testa.sub(1, to_end), "est");
|
||||
EXPECT_EQ(testa.sub(1, 2), "es");
|
||||
EXPECT_EQ(testa.sub(0, from_end(1)), "tes");
|
||||
EXPECT_EQ(testa.sub(from_end(2), to_end), "st");
|
||||
EXPECT_EQ(testa.sub(from_end(3), 2), "es");
|
||||
EXPECT_EQ(testa.sub(from_end(3), from_end(1)), "es");
|
||||
|
||||
EXPECT_EQ(testa.str_mid(1), "est");
|
||||
EXPECT_EQ(testa.str_mid(1, 0), "");
|
||||
EXPECT_EQ(testa.str_mid(1, 2), "es");
|
||||
EXPECT_EQ(testa.str_mid(2, 2), "st");
|
||||
|
||||
ssu testu = u"test";
|
||||
#if 0
|
||||
EXPECT_EQ(testu.substr(1, 0), u"est");
|
||||
EXPECT_EQ(testu.substr(1, 2), u"es");
|
||||
EXPECT_EQ(testu.substr(0, -1), u"tes");
|
||||
EXPECT_EQ(testu.substr(-2), u"st");
|
||||
EXPECT_EQ(testu.substr(-3, 2), u"es");
|
||||
EXPECT_EQ(testu.substr(-3, -1), u"es");
|
||||
#endif
|
||||
EXPECT_EQ(testu.sub(1, to_end), u"est");
|
||||
EXPECT_EQ(testu.sub(1, 2), u"es");
|
||||
EXPECT_EQ(testu.sub(0, from_end(1)), u"tes");
|
||||
EXPECT_EQ(testu.sub(from_end(2), to_end), u"st");
|
||||
EXPECT_EQ(testu.sub(from_end(3), 2), u"es");
|
||||
EXPECT_EQ(testu.sub(from_end(3), from_end(1)), u"es");
|
||||
|
||||
EXPECT_EQ(testu.str_mid(1), u"est");
|
||||
EXPECT_EQ(testu.str_mid(1, 0), u"");
|
||||
EXPECT_EQ(testu.str_mid(1, 2), u"es");
|
||||
EXPECT_EQ(testu.str_mid(2, 2), u"st");
|
||||
|
||||
ssw testw = L"test";
|
||||
#if 0
|
||||
EXPECT_EQ(testw.substr(1, 0), L"est");
|
||||
EXPECT_EQ(testw.substr(1, 2), L"es");
|
||||
EXPECT_EQ(testw.substr(0, -1), L"tes");
|
||||
EXPECT_EQ(testw.substr(-2), L"st");
|
||||
EXPECT_EQ(testw.substr(-3, 2), L"es");
|
||||
EXPECT_EQ(testw.substr(-3, -1), L"es");
|
||||
#endif
|
||||
EXPECT_EQ(testw.sub(1, to_end), L"est");
|
||||
EXPECT_EQ(testw.sub(1, 2), L"es");
|
||||
EXPECT_EQ(testw.sub(0, from_end(1)), L"tes");
|
||||
EXPECT_EQ(testw.sub(from_end(2), to_end), L"st");
|
||||
EXPECT_EQ(testw.sub(from_end(3), 2), L"es");
|
||||
EXPECT_EQ(testw.sub(from_end(3), from_end(1)), L"es");
|
||||
|
||||
EXPECT_EQ(testw.str_mid(1), L"est");
|
||||
EXPECT_EQ(testw.str_mid(1, 0), L"");
|
||||
EXPECT_EQ(testw.str_mid(1, 2), L"es");
|
||||
|
|
@ -327,7 +375,7 @@ TEST(SimStr, SimpleSubstr) {
|
|||
|
||||
TEST(SimStr, ToInt) {
|
||||
EXPECT_EQ(ssa{" 123"}.as_int<int>(), 123);
|
||||
EXPECT_EQ(ssa{" 123"}(0, -1).as_int<int>(), 12);
|
||||
EXPECT_EQ(ssa{" 123"}.get(0, from_end(1)).as_int<int>(), 12);
|
||||
EXPECT_EQ(ssa{"+123"}.as_int<int>(), 123);
|
||||
EXPECT_EQ(ssa{" -123aa"}.as_int<int>(), -123);
|
||||
EXPECT_EQ(ssa{"123"}.as_int<size_t>(), 123u);
|
||||
|
|
@ -484,6 +532,8 @@ TEST(SimStr, ToInt) {
|
|||
TEST(SimStr, to_double) {
|
||||
EXPECT_EQ(ssa{" 123"}.to_double(), 123.0);
|
||||
EXPECT_EQ(ssa{" 123.1"}.to_double(), 123.1);
|
||||
EXPECT_EQ(ssb{u8" 123"}.to_double(), 123.0);
|
||||
EXPECT_EQ(ssb{u8" 123.1"}.to_double(), 123.1);
|
||||
EXPECT_EQ(ssu{u" 123.13434"}.to_double(), 123.13434);
|
||||
EXPECT_EQ(ssuu{U" 123.13434"}.to_double(), 123.13434);
|
||||
EXPECT_EQ(ssw{L" 123.13434"}.to_double(), 123.13434);
|
||||
|
|
@ -808,7 +858,7 @@ TEST(SimStr, AssignSstring) {
|
|||
EXPECT_EQ(test = ssa{"other"}, "other");
|
||||
EXPECT_EQ(test = stringa{"trtr"_ss + 10}, "trtr10");
|
||||
EXPECT_EQ(test = "trtr"_ss + 20, "trtr20");
|
||||
EXPECT_EQ(test = test(2), "tr20");
|
||||
EXPECT_EQ(test = test.get(2, to_end), "tr20");
|
||||
EXPECT_EQ(test = lstringa<10>{"func"}, "func");
|
||||
EXPECT_EQ(test = lstringsa<10>{"func"}, "func");
|
||||
lstringsa<10> sample{15, "1234"};
|
||||
|
|
@ -937,10 +987,10 @@ TEST(SimStr, LStringAssign) {
|
|||
test = lstringa<1>{"next step"};
|
||||
EXPECT_EQ(test, "next step");
|
||||
|
||||
test = test(0);
|
||||
test = test.get(0, to_end);
|
||||
EXPECT_EQ(test, "next step");
|
||||
|
||||
test = test(1, 2);
|
||||
test = test.get(1, 2);
|
||||
EXPECT_EQ(test, "ex");
|
||||
|
||||
test = e_c(100, 'a');
|
||||
|
|
@ -958,13 +1008,23 @@ TEST(SimStr, LStringAssign) {
|
|||
|
||||
TEST(SimStr, UtfConvert) {
|
||||
EXPECT_EQ(stringa{ssu{u"testпройден"}}, "testпройден");
|
||||
EXPECT_EQ(stringa{ssb{u8"testпройден"}}, "testпройден");
|
||||
EXPECT_EQ(stringa{ssw{L"testпройден"}}, "testпройден");
|
||||
EXPECT_EQ(stringa{stringu{u"testпройден"}}, "testпройден");
|
||||
EXPECT_EQ(stringa{stringw{L"testпройден"}}, "testпройден");
|
||||
EXPECT_EQ(stringa{lstringu<40>{u"testпройден"}}, "testпройден");
|
||||
EXPECT_EQ(stringa{lstringw<40>{L"testпройден"}}, "testпройден");
|
||||
|
||||
EXPECT_EQ(stringb{ssu{u"testпройден"}}, u8"testпройден");
|
||||
EXPECT_EQ(stringb{ssa{u8"testпройден"}}, u8"testпройден");
|
||||
EXPECT_EQ(stringb{ssw{L"testпройден"}}, u8"testпройден");
|
||||
EXPECT_EQ(stringb{stringu{u"testпройден"}}, u8"testпройден");
|
||||
EXPECT_EQ(stringb{stringw{L"testпройден"}}, u8"testпройден");
|
||||
EXPECT_EQ(stringb{lstringu<40>{u"testпройден"}}, u8"testпройден");
|
||||
EXPECT_EQ(stringb{lstringw<40>{L"testпройден"}}, u8"testпройден");
|
||||
|
||||
EXPECT_EQ(stringu{ssa{"testпройден"}}, u"testпройден");
|
||||
EXPECT_EQ(stringu{ssb{u8"testпройден"}}, u"testпройден");
|
||||
EXPECT_EQ(stringu{ssw{L"testпройден"}}, u"testпройден");
|
||||
EXPECT_EQ(stringu{stringa{"testпройден"}}, u"testпройден");
|
||||
EXPECT_EQ(stringu{stringw{L"testпройден"}}, u"testпройден");
|
||||
|
|
@ -1316,9 +1376,9 @@ TEST(SimStr, LStrFormat) {
|
|||
}
|
||||
#else
|
||||
{
|
||||
// char32_t в Windows совместим по размеру с wchar_t, поэтому для его форматирования можно использовать
|
||||
// char32_t в Linux совместим по размеру с wchar_t, поэтому для его форматирования можно использовать
|
||||
// L"format_string", и передавать char32_t строковые объекты
|
||||
// char32_t on Windows is compatible in size with wchar_t, so you can use L"format_string" to format it
|
||||
// char32_t on Linux is compatible in size with wchar_t, so you can use L"format_string" to format it
|
||||
// and pass char32_t string objects
|
||||
lstringuu<2> text;
|
||||
text.format(L"{}{}", 'a', 'b');
|
||||
|
|
@ -1384,13 +1444,13 @@ TEST(SimStr, LStrJoinAndExpressions) {
|
|||
|
||||
int k = 10;
|
||||
double d = 12.1;
|
||||
lstringa<10> test = ">" + e_repl(buffer.to_str(), "<>", "-") + k + ", " + d;
|
||||
lstringa<10> test = ">" + e_repl(buffer, "<>", "-") + k + ", " + d;
|
||||
EXPECT_EQ(test, ">asd-fgh-jkl10, 12.1");
|
||||
|
||||
buffer.prepend(e_choice(test.length() > 2, eea + 99, eea + 12.1 + "asd"));
|
||||
EXPECT_EQ(buffer, "99asd<>fgh<>jkl");
|
||||
|
||||
buffer.change(2, 4, test(0, 3) + "__" + 1 + ',');
|
||||
buffer.change(2, 4, test.get(0, 3) + "__" + 1 + ',');
|
||||
EXPECT_EQ(buffer, "99>as__1,>fgh<>jkl");
|
||||
}
|
||||
|
||||
|
|
@ -1975,13 +2035,21 @@ TEST(SimStr, HexEpr) {
|
|||
|
||||
std::u32string textuu = +U"val = 0X"sv + e_hex<HexFlags::No0x | HexFlags::Short>(0x12Au);
|
||||
EXPECT_EQ(textuu, U"val = 0X12A");
|
||||
|
||||
if (sizeof(void*) == 8) {
|
||||
text = +"ptr = "sv + (const void*)0xdeadbeefcafe01;
|
||||
EXPECT_EQ(text, "ptr = 0x00DEADBEEFCAFE01");
|
||||
|
||||
const char* ptr = (const char*)0xdeadbeefcafe01;
|
||||
std::u16string utext = ptr + +u" freed"sv;
|
||||
EXPECT_EQ(utext, u"0x00DEADBEEFCAFE01 freed");
|
||||
} else {
|
||||
text = +"ptr = "sv + (const void*)0xdeadbeef;
|
||||
EXPECT_EQ(text, "ptr = 0xDEADBEEF");
|
||||
|
||||
const char* ptr = (const char*)0xdeadbeef;
|
||||
std::u16string utext = ptr + +u" freed"sv;
|
||||
EXPECT_EQ(utext, u"0xDEADBEEF freed");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(SimStr, EFill) {
|
||||
|
|
@ -2011,6 +2079,27 @@ TEST(SimStr, EIntFmt) {
|
|||
EXPECT_EQ(textu, u"val = 0x0000012A");
|
||||
}
|
||||
|
||||
TEST(SimStr, EChangeCase) {
|
||||
stringa test = e_upper("teSt");
|
||||
EXPECT_EQ(test, "TEST");
|
||||
test = e_lower(test);
|
||||
EXPECT_EQ(test, "test");
|
||||
test = e_upper("ɐ ɑ ı ſ");
|
||||
EXPECT_EQ(test, "Ɐ Ɑ I S");
|
||||
test = "-" + e_lower("İ Ⱥ Ⱦ ẞ") + "-";
|
||||
EXPECT_EQ(test, "-i ⱥ ⱦ ß-");
|
||||
|
||||
|
||||
stringu utest = e_upper(u"teSt");
|
||||
EXPECT_EQ(utest, u"TEST");
|
||||
utest = e_lower(utest);
|
||||
EXPECT_EQ(utest, u"test");
|
||||
utest = e_upper(u"ı ſ ɐ ɑ");
|
||||
EXPECT_EQ(utest, u"I S Ɐ Ɑ");
|
||||
utest = u"-" + e_lower(u"İ Ⱥ Ⱦ ẞ") + u"-";
|
||||
EXPECT_EQ(utest, u"-i ⱥ ⱦ ß-");
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
void check_equal(stra a, stra b) {
|
||||
EXPECT_EQ(a, b);
|
||||
|
|
@ -2068,7 +2157,64 @@ TEST(SimStr, ConstEval) {
|
|||
}
|
||||
#endif
|
||||
|
||||
struct sized_alloc {
|
||||
inline static size_t allocated = 0, dealloced = 0;
|
||||
inline static void* alloced = nullptr;
|
||||
|
||||
void* allocate(size_t bytes) {
|
||||
allocated += bytes;
|
||||
return alloced = ::operator new(bytes);
|
||||
}
|
||||
template<typename T>
|
||||
void deallocate(T* address, size_t size) noexcept {
|
||||
dealloced += size;
|
||||
EXPECT_EQ(address, alloced);
|
||||
if constexpr (requires{::operator delete(address, size);}) {
|
||||
::operator delete(address, size);
|
||||
} else {
|
||||
::operator delete(address);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST(SimStr, SizedAlloc) {
|
||||
sized_alloc::allocated = sized_alloc::dealloced = 0;
|
||||
{
|
||||
lstring<u8s, 0, true, sized_alloc> src{10, "test"};
|
||||
sstring<u8s, sized_alloc> str{std::move(src)};
|
||||
EXPECT_TRUE(src.is_empty());
|
||||
EXPECT_EQ(((Tstringa*)&str)->sharedCount(), SharedStringData<u8s>::check | 1);
|
||||
}
|
||||
EXPECT_EQ(sized_alloc::allocated, sized_alloc::dealloced);
|
||||
EXPECT_EQ(sized_alloc::allocated, 64);
|
||||
{
|
||||
sstring<u8s, sized_alloc> str{10, "test"};
|
||||
EXPECT_EQ(((Tstringa*)&str)->sharedCount(), 1);
|
||||
}
|
||||
EXPECT_EQ(sized_alloc::allocated, sized_alloc::dealloced);
|
||||
EXPECT_EQ(sized_alloc::allocated, 113);
|
||||
}
|
||||
|
||||
TEST(SimStr, SizedAllocU) {
|
||||
sized_alloc::allocated = sized_alloc::dealloced = 0;
|
||||
{
|
||||
lstring<u16s, 0, true, sized_alloc> src{10, u"test"};
|
||||
sstring<u16s, sized_alloc> str{std::move(src)};
|
||||
EXPECT_TRUE(src.is_empty());
|
||||
EXPECT_EQ(((Tstringa*)&str)->sharedCountForce(), SharedStringData<u8s>::check | 1);
|
||||
}
|
||||
EXPECT_EQ(sized_alloc::allocated, sized_alloc::dealloced);
|
||||
EXPECT_EQ(sized_alloc::allocated, 112);
|
||||
{
|
||||
sstring<u16s, sized_alloc> str{10, u"test"};
|
||||
EXPECT_EQ(((Tstringa*)&str)->sharedCountForce(), 1);
|
||||
}
|
||||
EXPECT_EQ(sized_alloc::allocated, sized_alloc::dealloced);
|
||||
EXPECT_EQ(sized_alloc::allocated, 202);
|
||||
}
|
||||
|
||||
} // namespace simstr::tests
|
||||
|
||||
TEST(SimStr, StrNoNamespace) {
|
||||
std::string str = "test";
|
||||
std::string test = +str + " = " + 10;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* ver. 1.6.5
|
||||
* ver. 1.9.1
|
||||
* (c) Проект "SimStr", Александр Орефков orefkov@gmail.com
|
||||
* Тесты simstr
|
||||
* (c) Project "SimStr", Aleksandr Orefkov orefkov@gmail.com
|
||||
|
|
|
|||
Loading…
Reference in New Issue