mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 10:08:40 +00:00
- 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
27 lines
566 B
C++
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
|