[PR #4606] [MERGED] Chunk uploads: a 2 ms cap per frame when the player set no budget #5724

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4606
Author: @apeirs
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: auto-upload-time-cap


📝 Commits (1)

  • 24e3696 Chunk uploads: a 2 ms cap per frame when the player set no budget

📊 Changes

1 file changed (+16 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+16 -1)

📄 Description

🤖 Opened by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally.

What and why

Fixes #4605. With Chunk Updates and Upload Budget at 0 (the defaults), update_world uploads every mesh that finished this frame. Flying fast into new terrain, a burst of meshes lands in one frame and that frame stutters; a lower frame cap makes it worse, since each frame collects more.

Without the player's budgets, a frame's batch of more than 8 meshes now goes through the existing queued path (nearest sections first, stale ones dropped), and uploads stop once they took AUTO_UPLOAD_TIME (2 ms) of the frame, with at least one per frame. Small batches still upload at once, unqueued. The player's own Chunk Updates / Upload Budget behave exactly as before. The idea is Sodium's: chunk uploads get a bounded share of the frame.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Horizon-only (renderer scheduling; vanilla has no equivalent budget). No world or simulation change.

Measurements

i7-11850H + RTX A3000 laptop, Linux, nightly 587f81f fast builds with and without this change, a copy of a real survival world, render distance 24, offscreen with --no-pause, HORIZON_SPIKES=25. Spectator flight at 50 blocks/s for 20 s into new terrain (horizon-ctl fly), two rounds, alternating builds, maxFps 260 and 120:

worst frame 0.1 % low 1 % low p99 upload ms inside frames over 25 ms
main (4 runs) 38.2 / 38.6 / 40.5 / 43.7 ms 28.0 / 26.8 / 29.5 / 25.0 fps 40.0 19.2 ms 54 / 24 / 13 / 28
this PR (4 runs) 31.4 / 34.9 / 38.7 / 37.4 ms 33.8 / 31.1 / 28.9 / 30.6 fps 42.5 18.2 ms 0 / 0 / 0 / 0

Uploads leave every slow frame. Chunks don't show up later in any way I could measure: sampling status once a second during the flight, pending_uploads was 0 on main and briefly 29 and 42 with this PR (gone by the next sample), and the same sections ended up meshed (70 053 vs 70 236).

Self-check

pr_ready (tools/pr_ready.py --quick on arch, against origin/main at af8f2fb7c, 4 min 35 s)

Check Result
Scope ✅ 1 files, +16 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (39 s)
rustfmt ✅ (7 s)
clippy ✅ (2 min 6 s)
tests: horizon-client ✅ 1086 passed (1 min 41 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/4606 **Author:** [@apeirs](https://github.com/apeirs) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `auto-upload-time-cap` --- ### 📝 Commits (1) - [`24e3696`](https://github.com/horizon-rust/horizon/commit/24e36962aaf145f97c62f7907ab25d5df39a25e4) Chunk uploads: a 2 ms cap per frame when the player set no budget ### 📊 Changes **1 file changed** (+16 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+16 -1) </details> ### 📄 Description > 🤖 Opened by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally. ## What and why Fixes #4605. With Chunk Updates and Upload Budget at 0 (the defaults), `update_world` uploads every mesh that finished this frame. Flying fast into new terrain, a burst of meshes lands in one frame and that frame stutters; a lower frame cap makes it worse, since each frame collects more. Without the player's budgets, a frame's batch of more than 8 meshes now goes through the existing queued path (nearest sections first, stale ones dropped), and uploads stop once they took `AUTO_UPLOAD_TIME` (2 ms) of the frame, with at least one per frame. Small batches still upload at once, unqueued. The player's own Chunk Updates / Upload Budget behave exactly as before. The idea is Sodium's: chunk uploads get a bounded share of the frame. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [x] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Horizon-only (renderer scheduling; vanilla has no equivalent budget). No world or simulation change. ## Measurements i7-11850H + RTX A3000 laptop, Linux, nightly 587f81f `fast` builds with and without this change, a copy of a real survival world, render distance 24, offscreen with `--no-pause`, `HORIZON_SPIKES=25`. Spectator flight at 50 blocks/s for 20 s into new terrain (`horizon-ctl fly`), two rounds, alternating builds, maxFps 260 and 120: | | worst frame | 0.1 % low | 1 % low | p99 | `upload` ms inside frames over 25 ms | |---|---|---|---|---|---| | main (4 runs) | 38.2 / 38.6 / 40.5 / 43.7 ms | 28.0 / 26.8 / 29.5 / 25.0 fps | 40.0 | 19.2 ms | 54 / 24 / 13 / 28 | | this PR (4 runs) | 31.4 / 34.9 / 38.7 / 37.4 ms | 33.8 / 31.1 / 28.9 / 30.6 fps | 42.5 | 18.2 ms | 0 / 0 / 0 / 0 | Uploads leave every slow frame. Chunks don't show up later in any way I could measure: sampling `status` once a second during the flight, `pending_uploads` was 0 on main and briefly 29 and 42 with this PR (gone by the next sample), and the same sections ended up meshed (70 053 vs 70 236). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on arch, against origin/main at af8f2fb7c, 4 min 35 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +16 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (39 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (2 min 6 s) | | tests: horizon-client | ✅ 1086 passed (1 min 41 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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 05:14:33 +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#5724
No description provided.