1
0

feat: add benchmark for string strip

This commit is contained in:
2025-09-29 21:20:44 +08:00
parent e7a05b3488
commit 19d0a5bb4d
3 changed files with 22 additions and 3 deletions

View File

@ -4,6 +4,8 @@ add_executable(YYCCBenchmark "")
target_sources(YYCCBenchmark
PRIVATE
main.cpp
yycc/string/op.cpp
)
# target_sources(YYCCBenchmark
# PRIVATE

View File

@ -1,4 +1,3 @@
#include <benchmark/benchmark.h>
int main(int argc, char* argv[]) {
return 0;
}
BENCHMARK_MAIN();

View File

@ -0,0 +1,18 @@
#include <benchmark/benchmark.h>
#include <yycc.hpp>
#include <yycc/string/op.hpp>
#define OP ::yycc::string::op
using namespace std::literals::string_view_literals;
namespace yyccbench::string::op {
static void StringStrip(benchmark::State& state) {
std::u8string_view strl = u8" \thello\r\n"sv, words = u8" \t\r\n"sv;
for (auto _ : state) {
auto rv = OP::strip(strl, words);
}
}
BENCHMARK(StringStrip);
}