From ab64916c379a145b57d21b95e4702bebf91747f3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 12 Apr 2026 18:32:03 -1000 Subject: [PATCH] [benchmark] Use -Os to match firmware optimization level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodSpeed benchmarks were building with -O2, while all firmware targets (ESP8266, ESP32, LibreTiny) use -Os. This mismatch means the benchmarks cannot detect inlining regressions that affect real devices — GCC under -O2 inlines functions that -Os outlines due to its size-conscious cost model. Remove the -Os unflag and -O2 override so benchmarks use the platform default -Os, matching what actually runs on devices. --- script/cpp_benchmark.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/script/cpp_benchmark.py b/script/cpp_benchmark.py index 92faa05819..c09c4dee90 100755 --- a/script/cpp_benchmark.py +++ b/script/cpp_benchmark.py @@ -26,11 +26,7 @@ CORE_BENCHMARKS_DIR: Path = Path(root_path) / "tests" / "benchmarks" / "core" STUBS_DIR: Path = Path(root_path) / "tests" / "benchmarks" / "stubs" PLATFORMIO_OPTIONS = { - "build_unflags": [ - "-Os", # remove default size-opt - ], "build_flags": [ - "-O2", # optimize for speed (CodSpeed recommends RelWithDebInfo) "-g", # debug symbols for profiling "-DUSE_BENCHMARK", # disable WarnIfComponentBlockingGuard in finish() f"-I{STUBS_DIR}", # stub headers for ESP32-only components