Pre-size hot path FastUtil collections in TrackerCtx and EntityCollisionCache - #892
Open
Smorki wants to merge 1 commit into
Open
Pre-size hot path FastUtil collections in TrackerCtx and EntityCollisionCache#892Smorki wants to merge 1 commit into
Smorki wants to merge 1 commit into
Conversation
Member
|
Do you have any spark profiler that can show that we need to pre-size these lists? |
Contributor
Author
|
Not right now ,but since these are hit frequently on hot paths, default resizes cause unnecessary allocation churn. ill run a quick load test with Spark in a few hours and share the profile here! |
Contributor
Author
|
Here is the Spark profile from a local test with high entity density and constant movement: It confirms that |
Collaborator
|
no TrackerCtx exists in the profiler, EntityCollisionCache is cached per world. It won't grow if there are enough slots
…________________________________
差出人: Emir ***@***.***>
送信日時: 2026年8月24日 19:53
宛先: Winds-Studio/Leaf ***@***.***>
CC: Subscribed ***@***.***>
件名: Re: [Winds-Studio/Leaf] Pre-size hot path FastUtil collections in TrackerCtx and EntityCollisionCache (PR #892)
[https://avatars.githubusercontent.com/u/224248969?s=20&v=4]Smorki left a comment (Winds-Studio/Leaf#892)<#892 (comment)>
Here is the Spark profile from a local test with high entity density and constant movement:
https://spark.lucko.me/5bLBhRr0KG
It confirms that TrackerCtx and EntityCollisionCache are active hot paths. Pre-sizing these ObjectArrayList instances helps avoid allocation churn from repeated internal array growth.
—
Reply to this email directly, view it on GitHub<#892?email_source=notifications&email_token=AQJV7UBOF32WL3NJH5DZKVT5LQNCDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZZGQZDAMZZGU3KM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-5394203956>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQJV7UDTDJGM5LCD4DDPBPD5LQNCDAVCNFSNUABFKJSXA33TNF2G64TZHM2DSOJRHAZDQOJXHNEXG43VMU5TKMRSHAZDSNBUGMZKC5QC>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AQJV7UCDX7TOTLTPSRONIS35LQNCDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZZGQZDAMZZGU3KM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ> and Android<https://github.com/notifications/mobile/android/AQJV7UCADVLQM4OTJBRXCBL5LQNCDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZZGQZDAMZZGU3KM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ>. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
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.
This PR provides sensible initial capacities for several
ObjectArrayListinstances inTrackerCtxandEntityCollisionCache.Since these collections are frequently populated during async tracking and entity collision phases, pre-sizing them helps avoid repeated array growth and reduces allocation churn in these hot paths.