From 8e0865384d254e93c4fd1255d5dc1f300f979da0 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Fri, 3 Oct 2025 22:47:30 +0800 Subject: [PATCH] fix: do misc work - add macos compile note in compile manual. - add DoNotOptimize in benchmark. --- COMPILE.md | 3 ++- benchmark/yycc/string/op.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/COMPILE.md b/COMPILE.md index aa80a15..3cc7f21 100644 --- a/COMPILE.md +++ b/COMPILE.md @@ -26,7 +26,8 @@ So you actually do not need Google Test, Google Benchmark and Doxygen. > [!WARNING] > You may face some issues when building on macOS with Clang. That's not your fault. > Clang used libc++ library lacks some essential features used by this project. -> You may try other solutions for compiling this project on macOS or with Clang. +> A possible solution is that use GCC and libstdc++ on macOS instead of default Clang and libc++. +> Build issue may be resolved until libc++ finish these features: `std::stacktrace` and `std::views::enumerate`. ### Google Test diff --git a/benchmark/yycc/string/op.cpp b/benchmark/yycc/string/op.cpp index 2f51f3c..bb27781 100644 --- a/benchmark/yycc/string/op.cpp +++ b/benchmark/yycc/string/op.cpp @@ -11,6 +11,7 @@ namespace yyccbench::string::op { 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::DoNotOptimize(rv); } } BENCHMARK(BM_StringStrip)->Name("StringStrip"); @@ -19,6 +20,7 @@ namespace yyccbench::string::op { std::u8string_view strl = u8" \thello\r\n"sv, words = u8" \t\r\n"sv; for (auto _ : state) { auto rv = OP::trim(strl, words); + benchmark::DoNotOptimize(rv); } } BENCHMARK(BM_StringTrim)->Name("StringTrim");