[PR #6743] [MERGED] Bench generation and light throughput per worker count #7062

Closed
opened 2026-11-03 06:33:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6743
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/gen-light-bench


📝 Commits (1)

  • f89a394 Bench generation and light throughput per worker count

📊 Changes

3 files changed (+415 additions, -0 deletions)

View changed files

📝 crates/horizon-client-lib/Cargo.toml (+4 -0)
📝 crates/horizon-client-render/src/streaming.rs (+55 -0)
➕ crates/horizon-client/examples/gen_light_bench.rs (+356 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Players on many-core PCs report slow world loading, and we had no way to measure generation and light throughput per
worker count. This adds one.

gen_light_bench (example of horizon-client-lib) runs the columns around a point through the whole streaming
pipeline (proto chunk, decoration, final column, light), as when a world loads, once per worker count, each on a
freshly seeded generator:

cargo run --release -p horizon-client-lib --example gen_light_bench -- \
    .local/horizon-client/26.3 [--seed 1234] [--center CX CZ] [--radius 12] \
    [--threads 1,2,4,8] [--period-ms 2] [--loading] [--repeat 1] [--json] [--simulate P,D,F]

It prints, per worker count: wall time and time to half the columns, columns finished and lit per second, CPU per
column, the coordinator's CPU (Streaming::update, one thread), and the workers' CPU
by job kind (streaming::job_stats, a few atomic counters, off unless the bench enables them: one branch per job
otherwise). The shared worker pool is sized once per process, so each worker count runs in a child process with
HORIZON_JOB_THREADS set. A checksum of blocks and light shows that builds and worker counts make the same world.

--simulate PROTO,DECORATE,FINISH (ms) swaps in a generator whose jobs sleep and return empty chunks: what is left is
the pipeline itself (coordinator, in-flight limits, decoration order, neighbour waits). Sleeping workers don't compete
for cores, so it shows how the pipeline scales to many workers even on a busy machine.

First findings with it (playhorizon, real terrain, seed 1234): CPU per column is proto 10-14 ms, decoration 2.3-3 ms,
final column 0.35 ms, light 1.4 ms. The simulated pipeline scales linearly from 1 to 32 workers at radius 12
(12.3 s -> 0.47 s); at radius 32 the coordinator thread became the limit (#6744). On the shared pool (this head,
--simulate 13,3,0.4 --radius 8): 1 / 4 / 8 workers = 6.68 / 1.69 / 0.86 s, same checksum.

No player-visible change: the counters are off in the game.

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at 3a264943c, 36 min 49 s)

Check Result
Scope ✅ 3 files, +415 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 602 passed (1 min 18 s)
rustfmt ✅ (16 s)
clippy ✅ (6 min 35 s)
tests: horizon-client-lib, horizon-client-render ❌ 1377 passed (27 min 38 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 137 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 125 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The ❌ is the known llvmpipe SIGSEGV of horizon-client-render's lib tests when they run in parallel on playhorizon (in gfx tests, which this PR doesn't touch). Rerun on this head with --test-threads=1: 1048 passed, 0 failed, 34 ignored.

🤖 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/6743 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/gen-light-bench` --- ### 📝 Commits (1) - [`f89a394`](https://github.com/horizon-rust/horizon/commit/f89a39479e6c313b79c11e9a62f35207bc1c340b) Bench generation and light throughput per worker count ### 📊 Changes **3 files changed** (+415 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-lib/Cargo.toml` (+4 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+55 -0) ➕ `crates/horizon-client/examples/gen_light_bench.rs` (+356 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Players on many-core PCs report slow world loading, and we had no way to measure generation and light throughput per worker count. This adds one. `gen_light_bench` (example of `horizon-client-lib`) runs the columns around a point through the whole streaming pipeline (proto chunk, decoration, final column, light), as when a world loads, once per worker count, each on a freshly seeded generator: ```sh cargo run --release -p horizon-client-lib --example gen_light_bench -- \ .local/horizon-client/26.3 [--seed 1234] [--center CX CZ] [--radius 12] \ [--threads 1,2,4,8] [--period-ms 2] [--loading] [--repeat 1] [--json] [--simulate P,D,F] ``` It prints, per worker count: wall time and time to half the columns, columns finished and lit per second, CPU per column, the coordinator's CPU (`Streaming::update`, one thread), and the workers' CPU by job kind (`streaming::job_stats`, a few atomic counters, off unless the bench enables them: one branch per job otherwise). The shared worker pool is sized once per process, so each worker count runs in a child process with `HORIZON_JOB_THREADS` set. A checksum of blocks and light shows that builds and worker counts make the same world. `--simulate PROTO,DECORATE,FINISH` (ms) swaps in a generator whose jobs sleep and return empty chunks: what is left is the pipeline itself (coordinator, in-flight limits, decoration order, neighbour waits). Sleeping workers don't compete for cores, so it shows how the pipeline scales to many workers even on a busy machine. First findings with it (playhorizon, real terrain, seed 1234): CPU per column is proto 10-14 ms, decoration 2.3-3 ms, final column 0.35 ms, light 1.4 ms. The simulated pipeline scales linearly from 1 to 32 workers at radius 12 (12.3 s -> 0.47 s); at radius 32 the coordinator thread became the limit (#6744). On the shared pool (this head, `--simulate 13,3,0.4 --radius 8`): 1 / 4 / 8 workers = 6.68 / 1.69 / 0.86 s, same checksum. No player-visible change: the counters are off in the game. **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at 3a264943c, 36 min 49 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +415 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 602 passed (1 min 18 s) | | rustfmt | ✅ (16 s) | | clippy | ✅ (6 min 35 s) | | tests: horizon-client-lib, horizon-client-render | ❌ 1377 passed (27 min 38 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 137 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 125 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The ❌ is the known llvmpipe SIGSEGV of `horizon-client-render`'s lib tests when they run in parallel on playhorizon (in `gfx` tests, which this PR doesn't touch). Rerun on this head with `--test-threads=1`: 1048 passed, 0 failed, 34 ignored. 🤖 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-03 06:33:06 +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#7062
No description provided.