[PR #2576] [MERGED] Lock the benchmark's load gate: a scene waits for the chunks it starts without #4440

Closed
opened 2026-11-03 04:17:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2576
Author: @levzzz5154
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/benchmark-load-gate


📝 Commits (1)

  • 731a356 Lock the benchmark's load gate: a scene waits for the chunks

📊 Changes

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

View changed files

📝 crates/horizon-client/src/benchmark.rs (+48 -0)

📄 Description

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

What and why

#1749 ("--benchmark: a scene counts as loaded before the integrated server sends its first chunk") is fixed on main by the merged #1992: crates/horizon-client/src/benchmark.rs's wait_loaded now waits for the resident chunk count to reach the view's target (view_chunks(render_distance), the same gate tools/perf_bench.py uses) before "steady" means loaded, so a scene that starts with an empty view is no longer measured before the integrated server has sent its first chunk.

What was missing is a test for that gate, so a change could drop it silently and the benchmark would go back to counting an empty world as loaded. This pull request adds one:

  • crates/horizon-client/src/benchmark.rs: the_load_waits_for_the_chunks_a_teleport_starts drives wait_loaded with a fake control that keeps the chunk counts steady and the queue empty for a second and a half - the state the game reports right after a teleport, before the server has sent anything - and only then lets the chunks arrive. The wait must not end before they do.

The test fails on the old rule and passes on the current one, so it guards exactly the behaviour the issue asked for.

Fixes #1749

Vanilla reference

  • tools/perf_bench.py (wait_loaded, view_chunks): the driver of the vanilla 26.3 runs, and the gate the in-game driver has to match, so the two reports are comparable. view_chunks is 80% of the view circle (pi x RD^2), the count the game keeps at RD 12 and RD 32.
  • The rule the gate protects: the client only has chunks once the server has sent them, so "the counts have not changed for a second and nothing is queued" means "nothing has arrived yet" right after a teleport, not "the scene is loaded".

Self-check

$ cargo test -p horizon-client --lib -- benchmark::
running 5 tests
test benchmark::tests::only_replaces_its_own_world ... ok
test benchmark::tests::scenarios ... ok
test benchmark::tests::the_load_waits_for_the_chunks_a_teleport_starts ... ok
test benchmark::tests::view_chunks_matches_perf_bench ... ok
test benchmark::tests::yaw_matches_vanilla ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 1210 filtered out; finished in 2.51s

The same test with the gate removed from wait_loaded (the rule before #1992) fails, which is what makes it a regression test:

thread 'benchmark::tests::the_load_waits_for_the_chunks_a_teleport_starts' panicked at crates/horizon-client/src/benchmark.rs:489:9:
the load finished before the chunks arrived

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1214 filtered out; finished in 1.01s

🤖 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/2576 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/benchmark-load-gate` --- ### 📝 Commits (1) - [`731a356`](https://github.com/horizon-rust/horizon/commit/731a35612addaf322fe04149c4a5d15f5498d650) Lock the benchmark's load gate: a scene waits for the chunks ### 📊 Changes **1 file changed** (+48 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/benchmark.rs` (+48 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why #1749 ("--benchmark: a scene counts as loaded before the integrated server sends its first chunk") is fixed on main by the merged #1992: `crates/horizon-client/src/benchmark.rs`'s `wait_loaded` now waits for the resident chunk count to reach the view's target (`view_chunks(render_distance)`, the same gate `tools/perf_bench.py` uses) before "steady" means loaded, so a scene that starts with an empty view is no longer measured before the integrated server has sent its first chunk. What was missing is a test for that gate, so a change could drop it silently and the benchmark would go back to counting an empty world as loaded. This pull request adds one: - `crates/horizon-client/src/benchmark.rs`: `the_load_waits_for_the_chunks_a_teleport_starts` drives `wait_loaded` with a fake control that keeps the chunk counts steady and the queue empty for a second and a half - the state the game reports right after a teleport, before the server has sent anything - and only then lets the chunks arrive. The wait must not end before they do. The test fails on the old rule and passes on the current one, so it guards exactly the behaviour the issue asked for. Fixes #1749 ## Vanilla reference - `tools/perf_bench.py` (`wait_loaded`, `view_chunks`): the driver of the vanilla 26.3 runs, and the gate the in-game driver has to match, so the two reports are comparable. `view_chunks` is 80% of the view circle (`pi x RD^2`), the count the game keeps at RD 12 and RD 32. - The rule the gate protects: the client only has chunks once the server has sent them, so "the counts have not changed for a second and nothing is queued" means "nothing has arrived yet" right after a teleport, not "the scene is loaded". ## Self-check ``` $ cargo test -p horizon-client --lib -- benchmark:: running 5 tests test benchmark::tests::only_replaces_its_own_world ... ok test benchmark::tests::scenarios ... ok test benchmark::tests::the_load_waits_for_the_chunks_a_teleport_starts ... ok test benchmark::tests::view_chunks_matches_perf_bench ... ok test benchmark::tests::yaw_matches_vanilla ... ok test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 1210 filtered out; finished in 2.51s ``` The same test with the gate removed from `wait_loaded` (the rule before #1992) fails, which is what makes it a regression test: ``` thread 'benchmark::tests::the_load_waits_for_the_chunks_a_teleport_starts' panicked at crates/horizon-client/src/benchmark.rs:489:9: the load finished before the chunks arrived test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1214 filtered out; finished in 1.01s ``` 🤖 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 04:17:10 +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#4440
No description provided.