[PR #516] [MERGED] streaming_bench: the chunk pipeline on its worker pool, without a window #2618

Closed
opened 2026-11-02 15:57:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/516
Author: @ludovic111
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ludovic111

Base: main ← Head: perf/streaming-bench


📝 Commits (1)

  • 69b3eb1 streaming_bench: the chunk pipeline on its worker pool, without a window

📊 Changes

1 file changed (+227 additions, -0 deletions)

View changed files

➕ crates/horizon-client/examples/streaming_bench.rs (+227 -0)

📄 Description

What

examples/streaming_bench.rs: the chunk pipeline (Streaming with VanillaTerrain: generation, decoration, lighting, meshing) on its worker pool, without a window. It reports:

  • fill: how long the area around (0, 0) takes to be generated, lit and meshed with N workers;
  • fly (--fly CHUNKS_PER_S --seconds T --hz F): the centre moves along +x while frames run at F per second, and the bench counts frames where a column within 2 chunks of the player is still unlit;
  • for both, what Streaming::update costs the calling thread (the render thread in the game): total, median, p99 and slowest call;
  • with HORIZON_BENCH_COUNT_ALLOCATIONS=1 at build time, the allocations made by update on the calling thread and by the whole process.
cargo build --profile fast -p horizon-client --example streaming_bench
target/fast/examples/streaming_bench .local/horizon-client/26.3 --threads 3 --radius 8 --fly 4 --seconds 10

Why

The game's --benchmark measures frames with everything else running; this one isolates the worker pool, so worker counts, priorities and job scheduling can be compared quickly and without a GPU (a headless ThinkPad, CI machines). --threads 3 and --threads 5 simulate 4- and 6-thread machines.

It found the stronghold ring stall fixed in #514: a sample of a fill showed 12 of 13 workers blocked on one OnceLock while one worker computed the 128 ring positions.

Numbers it gives today (origin/main + #514)

Machine workers fill radius 8 (253 columns) update p99 / max during fill
M4 Pro (busy with other sessions) 13 1.2 to 1.8 s 0.25 / 1.7 ms
i7-7500U ThinkPad, 2C/4T 2 8.28 s 0.17 / 2.5 ms
i7-7500U ThinkPad, 2C/4T 3 7.65 s 0.18 / 2.9 ms
i7-7500U ThinkPad, 2C/4T 4 7.22 s 0.18 / 1.7 ms

On the M4 Pro, flying at 8 chunks per second at radius 12, update takes p99 4.5 ms and up to 11.7 ms on the render thread.

How tested

Examples only, nothing players run. cargo fmt --all --check, cargo clippy -p horizon-client --all-targets -- -D warnings clean; run on macOS and NixOS as above.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/516 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/streaming-bench` --- ### 📝 Commits (1) - [`69b3eb1`](https://github.com/horizon-rust/horizon/commit/69b3eb1864553fa11ad8d0977c434291b0f28772) streaming_bench: the chunk pipeline on its worker pool, without a window ### 📊 Changes **1 file changed** (+227 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/examples/streaming_bench.rs` (+227 -0) </details> ### 📄 Description ## What `examples/streaming_bench.rs`: the chunk pipeline (`Streaming` with `VanillaTerrain`: generation, decoration, lighting, meshing) on its worker pool, without a window. It reports: - **fill**: how long the area around (0, 0) takes to be generated, lit and meshed with N workers; - **fly** (`--fly CHUNKS_PER_S --seconds T --hz F`): the centre moves along +x while frames run at F per second, and the bench counts frames where a column within 2 chunks of the player is still unlit; - for both, what `Streaming::update` costs the calling thread (the render thread in the game): total, median, p99 and slowest call; - with `HORIZON_BENCH_COUNT_ALLOCATIONS=1` at build time, the allocations made by `update` on the calling thread and by the whole process. ```sh cargo build --profile fast -p horizon-client --example streaming_bench target/fast/examples/streaming_bench .local/horizon-client/26.3 --threads 3 --radius 8 --fly 4 --seconds 10 ``` ## Why The game's `--benchmark` measures frames with everything else running; this one isolates the worker pool, so worker counts, priorities and job scheduling can be compared quickly and without a GPU (a headless ThinkPad, CI machines). `--threads 3` and `--threads 5` simulate 4- and 6-thread machines. It found the stronghold ring stall fixed in #514: a `sample` of a fill showed 12 of 13 workers blocked on one `OnceLock` while one worker computed the 128 ring positions. ## Numbers it gives today (origin/main + #514) | Machine | workers | fill radius 8 (253 columns) | update p99 / max during fill | | --- | ---: | ---: | ---: | | M4 Pro (busy with other sessions) | 13 | 1.2 to 1.8 s | 0.25 / 1.7 ms | | i7-7500U ThinkPad, 2C/4T | 2 | 8.28 s | 0.17 / 2.5 ms | | i7-7500U ThinkPad, 2C/4T | 3 | 7.65 s | 0.18 / 2.9 ms | | i7-7500U ThinkPad, 2C/4T | 4 | 7.22 s | 0.18 / 1.7 ms | On the M4 Pro, flying at 8 chunks per second at radius 12, `update` takes p99 4.5 ms and up to 11.7 ms on the render thread. ## How tested Examples only, nothing players run. `cargo fmt --all --check`, `cargo clippy -p horizon-client --all-targets -- -D warnings` clean; run on macOS and NixOS as above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:57:41 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2618
No description provided.