perf: bounded chunk candidate selection, O(1) commit lookups, per-pass light locks - #551
Draft
carabistouflette wants to merge 1 commit into
Draft
Conversation
13 tasks
…s light locks - ChunkSender::collect_candidates selects the closest pending positions with a bounded max-heap (vanilla Comparators.least) instead of fully sorting the pending set; kernel A/B measured 2.2x faster at 512 pending chunks and 5.5x at 4096 (criterion, quota 64) - commit_batch resolves prepared chunks through an FxHashMap built once per batch instead of a linear find per encoded chunk (O(B^2) -> O(B)) - the light publication pass defers sends to a per-player phase: each player's tracking view and chunk sender are locked once per pass instead of once per candidate chunk (up to 18 candidates); World:: send_deferred_light_updates owns the per-player resolution and get_light_packet_tracking_players is removed - chunk light section matching switches to an FxHashSet when a section delta list holds more than 4 entries
carabistouflette
force-pushed
the
pr7-chunk-light-efficiency
branch
from
August 29, 2026 01:02
90752fa to
3c3bf85
Compare
Contributor
|
idk if commit_batch iss really matter here and send_deferred_light_updates feel very, very risky |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Chunk and light outbound efficiency:
ChunkSender::collect_candidatesselects the closest pending chunk positions with a bounded max-heap (vanillaPlayerChunkSenderusesComparators.least(maxBatchSize, distanceSquared)) instead of fully sorting the entire pending set: O(P log P) → O(P log N).commit_batchresolves prepared chunks through anFxHashMapbuilt once per batch instead of a linearfindper encoded chunk: O(B²) → O(B).World::send_deferred_light_updatesowns the per-player resolution andget_light_packet_tracking_playersis removed.FxHashSetwhen a section delta list holds more than 4 entries.How this was tested
chunk_candidate_selection(identical data, both algorithms in one binary): bounded heap 4.36 µs vs 9.55 µs full-sort at 512 pending chunks (2.2x) and 12.05 µs vs 65.69 µs at 4096 (5.5x), quota 64.cargo test -p steel-core --lib(2422 tests) pass;cargo clippy -r --all-targetsclean. Light sends are grouped per player, so per-player packet order across different chunks changed; per-chunk light packets are independent and the client handles them in any order (same as vanilla's async sends).Screenshots / logs
N/A.
Checklist
Additional notes