Commit Graph
13753 Commits
Author SHA1 Message Date
J. Nick Koston 3fdb201f59 Suppress blocking warnings in scheduler benchmarks
Under valgrind, 2000 inner iterations take long enough in wall clock
to trigger WarnIfComponentBlockingGuard. Use a BenchComponent subclass
that sets warn_if_blocking_over_ to UINT16_MAX to prevent log noise.
2026-03-17 00:16:44 -10:00
J. Nick Koston ed539e17ff Add scheduler benchmark with 5 intervals firing per call
Adds Scheduler_Call_5IntervalsFiring: 5 intervals with 1ms period,
time advancing each inner iteration so all 5 fire every call().
This benchmarks the real scheduler hot path where callbacks execute.
2026-03-16 23:57:39 -10:00
J. Nick Koston 2061fa2393 Add inner loops to _Fresh benchmarks for CodSpeed consistency
Both _Fresh variants now use kInnerIterations with fresh buffer
creation inside the inner loop. This amortizes CodSpeed's per-iteration
instrumentation overhead while still measuring alloc+calc+encode per item.
2026-03-16 23:53:19 -10:00
J. Nick Koston 5d5a48c369 Fix _Fresh benchmark consistency and address review nits
- Remove inner loop from CalcAndEncode_DeviceInfoResponse_Fresh to match
  SensorStateResponse_Fresh — both now measure single alloc+encode per
  iteration as intended for heap allocation cost benchmarking
- Add comments documenting why _Fresh variants skip inner loops
- Add first-wins comment to load_component_yaml_configs
- Clean up .gitignore template comment
2026-03-16 23:52:27 -10:00
J. Nick Koston 8e4091baa3 Increase inner iterations from 1000 to 2000 to reduce jitter 2026-03-16 23:40:18 -10:00
J. Nick Koston dd52c91290 Add inner iteration loops to amortize CodSpeed instrumentation overhead
Sub-microsecond benchmarks are dominated by the ~60ns per-iteration
valgrind start/stop cost in CodSpeed simulation mode. Add kInnerIterations
(1000) inner loops to all fast benchmarks so the actual work dominates.
Move DoNotOptimize calls outside inner loops to prevent artificial overhead.

Also address review feedback:
- Use tokenless CodSpeed (public repo, no CODSPEED_TOKEN needed)
- Fix warning message to show component-specific path
- Fix stray ". :" in error message
- Verify pinned SHA on re-runs to prevent stale checkouts
2026-03-16 23:32:49 -10:00
J. Nick Koston 5b073ca520 Fix stale comment in main.cpp, simplify CI binary extraction 2026-03-16 22:48:39 -10:00
J. Nick Koston e34855b92e Add _Fresh variants to measure heap allocation cost in encode benchmarks 2026-03-16 22:44:16 -10:00
J. Nick Koston 621ba4d5b4 Set loop_interval to 0 in ApplicationLoop benchmark to skip sleep 2026-03-16 22:34:41 -10:00
J. Nick Koston 68cec9cc28 Add real Application::loop() benchmark, call original_setup() in main
- Call original_setup() in benchmark main.cpp so code-generated App
  initialization (pre_setup, area/device registration, looping_components_
  init) runs before benchmarks
- Restore ApplicationLoop_Empty benchmark that calls the actual App.loop()
2026-03-16 22:32:36 -10:00
J. Nick Koston a92147e1c9 Remove BM_ prefix, drop application loop benchmark, fix core includes
- Remove BM_ prefix from all benchmark names (unnecessary convention)
- Remove bench_application_loop.cpp (App needs pre_setup/setup which
  requires full code generation; will revisit as integration benchmark)
- Fix extra_include_dirs to use os.path.relpath for sibling directories
2026-03-16 22:27:03 -10:00
J. Nick Koston 456a7d740e Remove application loop benchmark - doesn't test real loop path 2026-03-16 22:14:51 -10:00
J. Nick Koston 10e05b5efa Build all benchmark code with -O2 instead of -Os 2026-03-16 22:13:11 -10:00
J. Nick Koston 93991317c4 Build benchmark library with -O2 to inline instrumentation hooks 2026-03-16 22:08:22 -10:00
J. Nick Koston ea5f62f030 Add -DNDEBUG to benchmark builds
The benchmark library warns "Library was built as DEBUG" without NDEBUG.
This enables debug assertions and disables optimizations in the benchmark
framework, causing instrumentation overhead to show up in profiles.
2026-03-16 22:03:16 -10:00
J. Nick Koston 6b88820400 Remove debug logging now that CodSpeed is working 2026-03-16 21:59:36 -10:00
J. Nick Koston f7d4b437d0 Pin codspeed-cpp to v2.1.0 release tag 2026-03-16 21:58:52 -10:00
J. Nick Koston 63201d4437 Fix CodSpeed: use CODSPEED_ANALYSIS not CODSPEED_SIMULATION
CodSpeed's CMake uses CODSPEED_ANALYSIS (not CODSPEED_SIMULATION) for
simulation mode. This define gates all the actual benchmark measurement
hooks in benchmark_runner.cpp and benchmark.h. Without it, benchmarks
run normally but CodSpeed doesn't detect them as instrumented.
2026-03-16 21:55:53 -10:00
J. Nick Koston baafecd0b2 Enable CodSpeed debug logging to diagnose 0 benchmarks issue 2026-03-16 21:50:04 -10:00
J. Nick Koston 374ca70f5b Add debug logging for CodSpeed build flags 2026-03-16 21:43:47 -10:00
J. Nick Koston cf672c1dc7 Add CODSPEED_ROOT_DIR to global build flags for relative paths in reports 2026-03-16 21:37:18 -10:00
J. Nick Koston b2e78d3753 Define CODSPEED_ENABLED globally for benchmark source files
benchmark.h uses #ifdef CODSPEED_ENABLED to switch benchmark
registration to CodSpeed-instrumented variants. This define was
only in library.json (applied to library compilation) but not to
the benchmark .cpp files that #include <benchmark/benchmark.h>.
Without it, CodSpeed reports "No benchmarks found".
2026-03-16 21:36:25 -10:00
J. Nick Koston 7c95a83c6c Remove stale codspeed_plan.md reference from main.cpp 2026-03-16 21:31:31 -10:00
J. Nick Koston 637180a628 Fix review issues: boolean comparison, missing trigger, constants
- Fix benchmarks CI condition: 'true' not 'True' (jq outputs lowercase)
- Add script/setup_codspeed_lib.py to benchmark infrastructure triggers
- Extract BENCHMARK_INFRASTRUCTURE_FILES and BENCHMARKS_COMPONENTS_PATH
  as top-level constants in determine-jobs.py
- Fix extra_include_dirs docstring
2026-03-16 21:30:00 -10:00
J. Nick Koston e7f1613159 Use shallow clone (depth 1) for codspeed-cpp 2026-03-16 21:26:22 -10:00
J. Nick Koston 0fc3fc2776 Clean up shared constants and setup script
- Move BASE_CODEGEN_COMPONENTS and USE_TIME_TIMEZONE_FLAG to test_helpers.py
- Use shared constants in both cpp_unit_test.py and cpp_benchmark.py
- Move json import to top level in cpp_benchmark.py
- Refactor setup_codspeed_lib.py into focused helper functions
- Combine clone + submodule init, use --shallow-submodules
2026-03-16 21:25:25 -10:00
J. Nick Koston f13513239d Fix CodSpeed instrumentation with PlatformIO
- Use CodSpeed's codspeed-cpp fork with proper instrumentation for
  simulation mode benchmark detection
- setup_codspeed_lib.py creates a flat PlatformIO-compatible library
  by combining google_benchmark sources, codspeed core, and
  instrument-hooks into a single library directory
- Renames .cc to .cpp (PlatformIO doesn't compile .cc by default)
- Adds all required defines: CODSPEED_ENABLED, CODSPEED_SIMULATION,
  CODSPEED_VERSION, CODSPEED_ROOT_DIR, CODSPEED_MODE_DISPLAY
- Output JSON config consumed by cpp_benchmark.py via env var
2026-03-16 21:21:44 -10:00
J. Nick Koston ff39fcbb94 Move CodSpeed library setup to Python script
Extract inline shell from CI workflow into script/setup_codspeed_lib.py.
Pins codspeed-cpp to a specific commit SHA for reproducibility.
2026-03-16 21:02:39 -10:00
J. Nick Koston 5cd2f58582 Use CodSpeed's codspeed-cpp fork for simulation mode
- Clone CodSpeed's codspeed-cpp repo (pinned to SHA) in CI
- Create PlatformIO-compatible library.json combining google_benchmark
  and codspeed core sources for proper instrumentation
- Pass library path via BENCHMARK_LIB env var to cpp_benchmark.py
- Use simulation mode for reproducible CPU instruction counting
- Locally, vanilla google/benchmark is used (no CodSpeed instrumentation)
2026-03-16 21:01:31 -10:00
J. Nick Koston a6219434b9 Move core benchmarks to tests/benchmarks/core/
Core is not a component — its benchmarks belong in tests/benchmarks/core/
not tests/benchmarks/components/core/. Add extra_include_dirs parameter
to build_and_run to support non-component benchmark directories.
2026-03-16 20:52:53 -10:00
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
J. Nick Koston d9cab03c09 Move benchmarks into ci.yml with determine-jobs integration
- Add should_run_benchmarks() to determine-jobs.py that checks if
  directly changed components have benchmark files (no dependency
  expansion - changing sensor won't trigger api benchmarks)
- Move benchmark job from separate workflow into ci.yml
- Pin CodSpeed action to full commit SHA
- Delete separate ci-benchmarks.yml
2026-03-16 20:44:37 -10:00
J. Nick Koston 38ff332fec [core] Add CodSpeed C++ benchmarks for protobuf and main loop
Add automated benchmarks using Google Benchmark to prevent performance
regressions in the API protobuf encoding/decoding and core loop paths.

Benchmarks cover:
- Protobuf encode: SensorState, BinarySensorState, HelloResponse,
  LightState, DeviceInfoResponse (20 nested devices + 20 areas)
- Protobuf decode: HelloRequest, SwitchCommand, LightCommand
- Protobuf calculate_size and full calc+encode send path
- Varint parse/encode/size for various value ranges
- Scheduler call/next_schedule_in with idle and active timers
- Application loop component dispatch and blocking guard overhead

Infrastructure:
- Extract shared build logic from cpp_unit_test.py into test_helpers.py
- Add cpp_benchmark.py mirroring the unit test build pattern
- Support benchmark.yaml per component dir for declaring dependencies
- Add CodSpeed CI workflow triggered on api/core changes
- Fix ProtoMessage protected destructor on host platform
2026-03-16 19:25:46 -10:00
Jesse Hills bba11b3b1e Merge branch 'beta' into dev 2026-03-17 14:14:03 +13:00
Jesse Hills a40d97f346 Merge pull request #14873 from esphome/bump-2026.3.0b3
2026.3.0b3
2026.3.0b3
2026-03-17 14:13:29 +13:00
Jesse Hills d6c67d5c35 Bump version to 2026.3.0b3 2026-03-17 11:45:03 +13:00
Jonathan Swoboda 0816b27398 [core] Support both dot and dash separators in Version.parse (#14858) 2026-03-17 11:45:03 +13:00
Jonathan Swoboda 9133582aa0 [as3935] Fix ENERGY_MASK dropping bit 4 of lightning energy MMSB (#14861) 2026-03-17 11:45:02 +13:00
Jonathan Swoboda f36b0fcb61 [am43] Fix battery update throttle using wrong type (#14864) 2026-03-17 11:45:02 +13:00
Jonathan Swoboda bb0a5dc8a8 [lilygo_t5_47] Fix Y coordinate mapping and clamp touch point count (#14865) 2026-03-17 11:45:02 +13:00
Jonathan Swoboda 0c260e483e [gpio][dallas_temp] Fix one_wire read64() and DS18S20 division by zero (#14866) 2026-03-17 11:45:02 +13:00
tomaszduda23 b8ce907976 [ble_nus] fix uart debug (#14850) 2026-03-17 11:45:02 +13:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ffce637ea5 Bump aioesphomeapi from 44.5.1 to 44.5.2 (#14849)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-17 11:45:02 +13:00
J. Nick KostonCopilot Autofix powered by AIpre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
d6fba39037 [runtime_image] Add esp-dsp dependency for JPEGDEC SIMD on ESP32 (#14840)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-03-17 11:45:02 +13:00
J. Nick Koston 5d5c2723b2 [fastled] Include esp_lcd IDF component for ESP32-S3 compatibility (#14839) 2026-03-17 11:45:02 +13:00
guillempagesandJonathan Swoboda 06d1498c47 [runtime_image] Update jpegdec lib version (#14726)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-03-17 11:45:02 +13:00
Fabrice 2142bc1b76 [mipi_rgb] Make h- and v-sync pins optional (#14870) 2026-03-17 09:25:11 +11:00
KamilCuk f81e04b036 [web_server] Fix wrong printf format specifier (#14836) 2026-03-16 11:30:31 -10:00
Jonathan SwobodaandJ. Nick Koston c3327d0b43 [i2s_audio] Fix ESP-IDF 6.0 compatibility for I2S port types (#14818)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
2026-03-16 16:04:20 -04:00
Jonathan Swoboda 8577c26358 [i2c] Handle ESP_ERR_INVALID_RESPONSE as NACK for IDF 6.0 (#14867) 2026-03-16 20:03:09 +00:00