Skip to content

Add BenchmarkDotNet harness and benchmarks project#32

Merged
KonH merged 5 commits into
mainfrom
codex/implement-benchmarkdotnet-harness
Jul 20, 2026
Merged

Add BenchmarkDotNet harness and benchmarks project#32
KonH merged 5 commits into
mainfrom
codex/implement-benchmarkdotnet-harness

Conversation

@KonH

@KonH KonH commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Add a standalone BenchmarkDotNet harness to measure performance of core systems outside of Unity.
  • Provide repeatable microbenchmarks for the ECS world, game systems, and the game loop to guide optimizations.
  • Keep benchmarks in a separate project so they do not affect runtime or production code.

Description

  • Add new GlobalStrategy.Benchmarks project with Program entry and GlobalStrategy.Benchmarks.csproj referencing BenchmarkDotNet and core projects.
  • Add BenchmarkGameFactory which constructs an in-memory GameLogic using static config sources for lightweight game-loop benchmarking.
  • Add EcsWorldBenchmarks, GameSystemsBenchmarks, and GameLoopBenchmarks to measure entity creation, component addition, queries and mutation, monthly system updates, and repeated GameLogic.Update ticks.
  • Add README.md documenting how to run the benchmarks and update GlobalStrategy.Core.sln to include the new project.

Testing

  • No automated tests were run as part of this change.

Codex Task

KonH and others added 4 commits July 20, 2026 18:35
Provide a focused baseline so converter regressions can be measured independently of game-loop work.

Co-Authored-By: GPT-5 <noreply@openai.com>
The prior GlobalStrategy.Benchmarks project predated
Docs/Specs/26_07_18_18_benchmarkdotnet-perf-harness/plan.md and satisfied
almost none of its acceptance criteria: wrong project identity, a
hand-built 2-country fixture instead of the real 163-country world, no
snapshot/compare/update-baseline CLI, and no skills, Ralph integration,
or Constitution carve-out.

Renamed to Game.Benchmarks and rebuilt the fixture on
Game.ConsoleRunner.Program.BuildContext so benchmarks run against the
real committed Assets/Configs data. Replaced the stale benchmark set
(which also predated the resource-collector pipeline migration -
CountryScoreSystem/OrgScoreSystem no longer exist) with coverage of the
full tick, the two unchanged per-tick systems, the ordered
ResourceSystem pipeline, and each individual resource collector -
kept the pre-existing ECS micro-benchmarks and rebuilt
VisualStateConverterBenchmarks against the real fixture per request.

Added the snapshot/gate/CLI layer (--compare/--update-baseline),
seeded a real initial Docs/Benchmarks/ baseline from an actual run,
and added the /benchmark-report and /optimize-performance skills, the
Ralph driver's perf mode, the /complete-prd perf: form, and the
Constitution's performance-optimization carve-out.

Fixed two correctness bugs surfaced while building this: BenchmarkDotNet's
out-of-process toolchain runs from a build-output subfolder (config
paths need a repo-root env var handoff, not process isolation given up),
and TimeSystemBenchmarks was mutating shared GameTime across millions of
unrolled invocations, eventually overflowing DateTime.

Also promoted dotnet-build/dotnet-test from user-level to project-level
skills and added a matching dotnet-benchmark skill, since they're used
as project conventions, not personal ones.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Re-collected all 22 benchmarks after the harness rebuild landed, so
the committed baseline reflects the harness in its final committed
state rather than the numbers gathered mid-implementation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@KonH
KonH merged commit 586087d into main Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant