Commit Graph

9 Commits

Author SHA1 Message Date
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 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 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 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