Skip to content

perf: engine optimization pass and benchmark scripts - #93

Open
CanReader wants to merge 9 commits into
stagingfrom
engine-optimization
Open

CanReader wants to merge 9 commits into
stagingfrom
engine-optimization

Conversation

@CanReader

@CanReader CanReader commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Pins the engine to engine-optimization (CanReader/SleakEngine#227), adds a repeatable benchmark, and fixes stutter while moving through the world.

Changes

  • scripts/bench_run.sh: deterministic runs (capture mode: fixed 1/60 step, synchronous chunk loading, fixed seed) that keep each run's CSV, log and frame capture. Defaults to the real display; BENCH_HEADLESS=1 uses Xvfb, where present is a CPU copy so only the CPU/GPU columns mean anything.
  • scripts/bench_compare.py: per-scenario mean ± stdev of FPS, frame time, CPU frame, GPU passes and culling, plus capture md5s for pixel-identity checks. Truncated runs are skipped.
  • -world, --autofly and -campose now work in Release builds when --bench is passed (still Debug-only otherwise).
  • --bench-postfx turns on SSAO, SSR and bloom so those engine paths can be measured.
  • Column mesh merging reuses scratch buffers and copies each chunk in bulk instead of growing fresh vectors per rebuild. Most of the old cost was page faults on new memory. Output is byte-identical.
  • Main-thread column rebuilds stop once they pass 2 ms in a frame (ChunkManager::UPLOAD_BUDGET_MS); the rest stay dirty for the next frame.

Results

Standing still: see CanReader/SleakEngine#227. Vulkan at 1600x900, render distance 12: about 212 → 220 FPS, CPU frame 2.05 → 1.62 ms, output byte-identical to staging.

Flying (--autofly 20, fullscreen 1920x1080, render distance 16, Release, before/after runs interleaved):

Before After
Average FPS 117 137
p99 frame time 23.0 ms 15.3 ms
Frames over 16.7 ms 4.5/s 0.9/s
CPU frame p99 15.5 ms 8.0 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant