perf: scope same-chunk entity tracker refreshes with a chunk index - #552
Draft
carabistouflette wants to merge 2 commits into
Draft
perf: scope same-chunk entity tracker refreshes with a chunk index#552carabistouflette wants to merge 2 commits into
carabistouflette wants to merge 2 commits into
Conversation
…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
- EntityTracker keeps entities_by_chunk, a secondary index updated on add, remove, removal of dead entities, and section moves - update_player_nearby evaluates only entities registered within the view radius of the player chunk; ChunkMap::update_player_status uses it when the view is unchanged (pure same-chunk movement), which previously scanned every tracked entity in the world - full update_player scans remain for view changes, initial joins, and batch commits - the shared visibility predicate is extracted to entity_visible_to_player so both paths stay in lockstep with vanilla's updatePlayer rules - regression test covers scoping, idempotence, and despawn on removal
carabistouflette
force-pushed
the
pr8-tracker-refresh-scoping
branch
from
August 29, 2026 01:04
4ecff48 to
e8ab007
Compare
|
This pull request has conflicts with the base branch "master". Please resolve those so we can test out your changes. |
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
Scopes same-chunk entity tracker refreshes:
EntityTrackerkeepsentities_by_chunk, a secondary index of entity IDs by registered chunk, maintained on add, remove, dead-entity removal, and section moves.update_player_nearby(player, view, center, radius_chunks, is_chunk_sent)evaluates only entities registered within the view radius of the player chunk.ChunkMap::update_player_statususes it when the view is unchanged (pure same-chunk movement) — previously every accepted movement scanned every tracked entity in the world (entities.iter_sync).update_playerscans remain for cross-chunk view changes, initial joins, and chunk batch commits.entity_visible_to_playerso both paths stay in lockstep with vanilla'supdatePlayerrules.How this was tested
update_player_nearby_uses_chunk_registry_without_full_scan: scoping (far entity outside the radius is neither evaluated nor despawned), idempotence (no duplicate spawn packets for already-paired entities), and despawn-on-removal (removed entities inside the radius are despawned withCRemoveEntities).cargo test -p steel-core --lib(2422 tests) pass;cargo clippy -r --all-targetsclean.Screenshots / logs
N/A.
Checklist
Additional notes
CRemoveEntitiesin the nearby despawn path) — kept as the guard against reintroducing it.pr7-chunk-light-efficiency(base of this PR).