[GH-ISSUE #4041] Reuse worker meshing scratch and bounded SectionMesh capacity to reduce allocation churn #1182

Closed
opened 2026-11-02 15:44:53 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ult1mq on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4041

Originally assigned to: @ult1mq on GitHub.

🤖 Filed by ult1mq's AI agent (Codex, GPT-6), not by ult1mq personally.

Non-empty section jobs allocate padded block/light arrays and unpack storage afresh, and uploaded CPU geometry is later freed. Fast flight creates repeated allocation/deallocation traffic while streaming workers and the frame thread share the process allocator. A Windows investigation on nightly baa379d observed the frame thread waiting in heap routines in 112/242 outbound samples; this is a motivation, not an isolated speedup estimate.

Proposed independent optimization: keep reusable scratch per streaming worker and recycle cleared SectionMesh vector capacity through a worker-only pool capped at 128 meshes and 16 MiB. Uniform-air jobs should keep their early return. Reuse must reset visibility, side buckets and block-entity candidates, and remain correct across missing neighbors and resource reloads.

A focused draft PR will include reset/cap/accounting tests, an explicitly invoked full-geometry equivalence fixture, and an opt-in isolated padding benchmark with raw samples and a graph. It will leave queue priorities/in-flight limits unchanged; those are already being worked on in #3961. No whole-game FPS improvement will be attributed to this change without isolation.

🤖 Generated with Codex

Originally created by @ult1mq on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4041 Originally assigned to: @ult1mq on GitHub. > 🤖 Filed by ult1mq's AI agent (Codex, GPT-6), not by ult1mq personally. Non-empty section jobs allocate padded block/light arrays and unpack storage afresh, and uploaded CPU geometry is later freed. Fast flight creates repeated allocation/deallocation traffic while streaming workers and the frame thread share the process allocator. A Windows investigation on nightly baa379d observed the frame thread waiting in heap routines in 112/242 outbound samples; this is a motivation, not an isolated speedup estimate. Proposed independent optimization: keep reusable scratch per streaming worker and recycle cleared SectionMesh vector capacity through a worker-only pool capped at 128 meshes and 16 MiB. Uniform-air jobs should keep their early return. Reuse must reset visibility, side buckets and block-entity candidates, and remain correct across missing neighbors and resource reloads. A focused draft PR will include reset/cap/accounting tests, an explicitly invoked full-geometry equivalence fixture, and an opt-in isolated padding benchmark with raw samples and a graph. It will leave queue priorities/in-flight limits unchanged; those are already being worked on in #3961. No whole-game FPS improvement will be attributed to this change without isolation. 🤖 Generated with [Codex](https://openai.com/codex/)
Author
Owner

@ult1mq commented on GitHub (Oct 29, 2026):

/claim

🤖 Agent: Preparing the isolated mesh buffer reuse draft PR for ult1mq.

<!-- gh-comment-id:6510473916 --> @ult1mq commented on GitHub (Oct 29, 2026): /claim 🤖 Agent: Preparing the isolated mesh buffer reuse draft PR for ult1mq.
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#1182
No description provided.