-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use EntityHashMap<Entity, T> for render world entity storage for better performance #9903
Merged
superdump
merged 15 commits into
bevyengine:main
from
superdump:render-world-use-passhashmap
Sep 27, 2023
+584
−324
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
84fd754
Use PassHashMap<Entity, T> for render world entity storage for better…
superdump c3ef067
Fix wireframe and clippy
superdump ad94257
Use all 64-bits of the Entity for a hash all the time.
superdump f904037
Merge branch 'main' into render-world-use-passhashmap
superdump 11a1612
Move imports
superdump 249b6a3
Improve docs
superdump 98b34f6
Use Skifire's suggested hash function and rename to EntityHashMap
superdump df0502c
Use the old capacity method for allocating the vec for mesh extraction
superdump 903d5ab
Document the magic constant
superdump 91afe4d
CI documentation fix
superdump 07aae97
CI fixes
superdump eac5b46
Revert ExtractComponent impl for Handle<T> to using clone_weak() inst…
superdump 43e4752
Remove unnecessary import
superdump ef26d87
Clear SkinIndices before extracting
superdump 5661895
Inline Entity hash function
superdump File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be a
Component
though. I'd prefer if it was newtypedmaking this a component may be misleading for users, they might accidentally insert an
AssetId
when they mean to insert aHandle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had discussed this with Cart and we thought it should become a component. The only reason I needed to change it was because ExtractComponent is implemented for
Handle<T>
and is supposed to extract to aHandle<T>
at the moment, and we rather thought it should extract to anAssetId<T>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it should be a newtype. I can see the the disadvantages but not the advantages (apart from expediency, I'd be glad to open a PR after this one is merged if that's the only problem). Maybe there is an advantage I'm missing. Could you link me to the conversation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't as it was in DMs on Discord. On the batching PR, Cart mentioned that
AssetId<T>
should be used if a weak handle is desired, such as how I was using it there. It felt appropriate to also switch toAssetId<T>
as part of this PR.I am happy to wrap
AssetId<T>
in a newtype, but I don't understand why I would do it. I hear that you think a user might insert anAssetId<T>
when they should have used aHandle<T>
but I don't understand why wrapping it in a newtype would make much difference to that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mentioned on Discord that it's easy for someone to see Handle and AssetId are both Components and think they can use either, whereas a newtype wrapper around AssetId gives a bit more friction. I decided to revert the change that made AssetId a Component and revert the change to the ExtractComponent impl for Handle. I think it's better taken in a separate PR. :) Thanks for noticing it!