Files
esphome/tests/benchmarks/components/core/bench_helpers.cpp
T
J. Nick Koston 9c148da76a Add core benchmarks dir, fix core pseudo-component, use simulation mode
- Move scheduler/loop/helpers benchmarks to tests/benchmarks/components/core/
- Add random_float and random_uint32 benchmarks (from ol.yaml)
- Fix core pseudo-component crash: skip components where get_component()
  returns None when adding dependencies to config
- Use CodSpeed simulation mode (CPU instruction counting) for reproducible
  CI results instead of walltime
2026-03-16 20:49:48 -10:00

27 lines
566 B
C++

#include <benchmark/benchmark.h>
#include "esphome/core/helpers.h"
namespace esphome::benchmarks {
// --- random_float() ---
// Ported from ol.yaml:148 "Random Float Benchmark"
static void BM_RandomFloat(benchmark::State &state) {
for (auto _ : state) {
benchmark::DoNotOptimize(random_float());
}
}
BENCHMARK(BM_RandomFloat);
// --- random_uint32() ---
static void BM_RandomUint32(benchmark::State &state) {
for (auto _ : state) {
benchmark::DoNotOptimize(random_uint32());
}
}
BENCHMARK(BM_RandomUint32);
} // namespace esphome::benchmarks