From 456a7d740e816d69445952b81fb2686190bef2d6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 16 Mar 2026 22:14:51 -1000 Subject: [PATCH] Remove application loop benchmark - doesn't test real loop path --- .../core/bench_application_loop.cpp | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 tests/benchmarks/core/bench_application_loop.cpp diff --git a/tests/benchmarks/core/bench_application_loop.cpp b/tests/benchmarks/core/bench_application_loop.cpp deleted file mode 100644 index 2489d4e9ac1..00000000000 --- a/tests/benchmarks/core/bench_application_loop.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include - -#include "esphome/core/application.h" -#include "esphome/core/component.h" -#include "esphome/core/hal.h" - -namespace esphome::benchmarks { - -// A minimal component with an empty loop for benchmarking dispatch overhead -class NoopComponent : public Component { - public: - void loop() override {} - float get_setup_priority() const override { return 0.0f; } - // Expose protected method for benchmarking - void set_loop_state() { this->set_component_state_(COMPONENT_STATE_LOOP); } -}; - -// --- WarnIfComponentBlockingGuard overhead --- - -static void BM_WarnIfComponentBlockingGuard(benchmark::State &state) { - NoopComponent component; - uint32_t now = millis(); - - for (auto _ : state) { - WarnIfComponentBlockingGuard guard{&component, now}; - now = guard.finish(); - benchmark::DoNotOptimize(now); - } -} -BENCHMARK(BM_WarnIfComponentBlockingGuard); - -// --- Component virtual dispatch overhead --- - -static void BM_ComponentDispatch(benchmark::State &state) { - NoopComponent component; - component.set_loop_state(); - uint32_t now = millis(); - - for (auto _ : state) { - { - WarnIfComponentBlockingGuard guard{&component, now}; - component.loop(); - now = guard.finish(); - } - benchmark::DoNotOptimize(now); - } -} -BENCHMARK(BM_ComponentDispatch); - -} // namespace esphome::benchmarks