-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from contour-terminal/improvement/add_benchmar…
…k_and_std_simd Add benchmark and std::simd
- Loading branch information
Showing
9 changed files
with
216 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"version": 6, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 27, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "local-devel", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CMAKE_CXX_FLAGS": "-march=native" | ||
} | ||
}, | ||
{ | ||
"name": "libunicode-common", | ||
"hidden": true, | ||
"binaryDir": "${sourceDir}/build/${presetName}", | ||
"generator": "Ninja", | ||
"cacheVariables": { | ||
"LIBUNICODE_TESTING": "ON", | ||
"LIBUNICODE_BENCHMARK": "ON", | ||
"PEDANTIC_COMPILER": "OFF", | ||
"PEDANTIC_COMPILER_WERROR": "ON" | ||
} | ||
}, | ||
{ | ||
"name": "release", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "RelWithDebInfo" | ||
} | ||
}, | ||
{ | ||
"name": "linux-clang-release", | ||
"displayName": "Linux 64-bit", | ||
"inherits": ["libunicode-common", "release"], | ||
"cacheVariables": { | ||
"CMAKE_CXX_COMPILER": "clang++" | ||
} | ||
}, | ||
{ | ||
"name": "linux-gcc-release", | ||
"displayName": "Linux 64-bit", | ||
"inherits": ["libunicode-common", "release"], | ||
"cacheVariables": { | ||
"CMAKE_CXX_COMPILER": "g++" | ||
} | ||
}, | ||
{ | ||
"name": "linux-devel-clang-release", | ||
"displayName": "Linux 64-bit", | ||
"inherits": ["libunicode-common", "release", "local-devel"], | ||
"cacheVariables": { | ||
"CMAKE_CXX_COMPILER": "clang++" | ||
} | ||
}, | ||
{ | ||
"name": "linux-devel-gcc-release", | ||
"displayName": "Linux 64-bit", | ||
"inherits": ["libunicode-common", "release", "local-devel"], | ||
"cacheVariables": { | ||
"CMAKE_CXX_COMPILER": "g++" | ||
} | ||
} | ||
], | ||
"buildPresets": [ | ||
{ "name": "linux-clang-release", "configurePreset": "linux-clang-release" }, | ||
{ "name": "linux-gcc-release", "configurePreset": "linux-gcc-release" }, | ||
{ "name": "linux-devel-clang-release", "configurePreset": "linux-devel-clang-release" }, | ||
{ "name": "linux-devel-gcc-release", "configurePreset": "linux-devel-gcc-release" } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <libunicode/convert.h> | ||
#include <libunicode/scan.h> | ||
#include <libunicode/utf8.h> | ||
|
||
#include <string_view> | ||
|
||
#include <benchmark/benchmark.h> | ||
|
||
using std::string_view; | ||
|
||
template <size_t L> | ||
static void benchmarkWithLength(benchmark::State& state) | ||
{ | ||
auto TestText = std::string(L, 'a') + "\u00A9"; | ||
for (auto _: state) | ||
{ | ||
benchmark::DoNotOptimize(unicode::detail::scan_for_text_ascii(TestText, L + 10)); | ||
} | ||
} | ||
|
||
template <size_t L> | ||
static void benchmarkWithOffset(benchmark::State& state) | ||
{ | ||
auto TestText = std::string(L, 'a') + "\u0001F600" + std::string(1000, 'a'); | ||
for (auto _: state) | ||
{ | ||
benchmark::DoNotOptimize(unicode::detail::scan_for_text_ascii(TestText, L + 10)); | ||
} | ||
} | ||
|
||
BENCHMARK(benchmarkWithLength<1>); | ||
BENCHMARK(benchmarkWithLength<10>); | ||
BENCHMARK(benchmarkWithLength<100>); | ||
BENCHMARK(benchmarkWithLength<1000>); | ||
BENCHMARK(benchmarkWithLength<10000>); | ||
BENCHMARK(benchmarkWithLength<100000>); | ||
BENCHMARK(benchmarkWithLength<1000000>); | ||
|
||
BENCHMARK(benchmarkWithOffset<5>); | ||
BENCHMARK(benchmarkWithOffset<10>); | ||
BENCHMARK(benchmarkWithOffset<15>); | ||
BENCHMARK(benchmarkWithOffset<20>); | ||
BENCHMARK(benchmarkWithOffset<25>); | ||
BENCHMARK(benchmarkWithOffset<30>); | ||
BENCHMARK(benchmarkWithOffset<35>); | ||
BENCHMARK(benchmarkWithOffset<40>); | ||
BENCHMARK(benchmarkWithOffset<45>); | ||
BENCHMARK(benchmarkWithOffset<50>); | ||
BENCHMARK(benchmarkWithOffset<55>); | ||
BENCHMARK(benchmarkWithOffset<60>); | ||
BENCHMARK(benchmarkWithOffset<65>); | ||
BENCHMARK(benchmarkWithOffset<70>); | ||
BENCHMARK(benchmarkWithOffset<75>); | ||
BENCHMARK(benchmarkWithOffset<80>); | ||
BENCHMARK(benchmarkWithOffset<85>); | ||
BENCHMARK(benchmarkWithOffset<90>); | ||
BENCHMARK(benchmarkWithOffset<95>); | ||
BENCHMARK(benchmarkWithOffset<100>); | ||
BENCHMARK(benchmarkWithOffset<105>); | ||
BENCHMARK(benchmarkWithOffset<110>); | ||
BENCHMARK(benchmarkWithOffset<115>); | ||
BENCHMARK(benchmarkWithOffset<120>); | ||
BENCHMARK(benchmarkWithOffset<125>); | ||
BENCHMARK(benchmarkWithOffset<130>); | ||
|
||
// Run the benchmark | ||
BENCHMARK_MAIN(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters