-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove unnecessary clone when redundantly adding resource to tracker #6969
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
Conversation
d1fff08 to
6e0ed0a
Compare
6e0ed0a to
6146ad3
Compare
6146ad3 to
9cc2301
Compare
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.
nice! Would be great though to see benchmarks justifying this. Yes, this looks faster and should help addressing one of our key hotspots, but I think we should hold ourselves to a high standard and justify this kind of added complexity/indirection with data.
("Request changes" bc of that.)
| /// | ||
| /// Because [`ResourceMetadata`] is generic over [`Arc`] and [`Weak`], | ||
| /// we need a trait to give us the implementations for each. | ||
| pub trait Insertable: Sized { |
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.
name isn't great, suggests a generality that isn't intended here. Maybe InsertableResource would be better already?
|
I had some profiles a while ago that pointed directly there, but they were in rend3 and vtune on an old machine so don't have them anymore. I'm not entirely sure what whole-stack tests are out there, but I'll poke around. |
|
I'd think some of our existing benchmarks in the repo should hit this quite a bit as well |
|
@Wumpf I have bad news.... The thing this PR is solving for doesn't happen.... At all. Yes there is a "redundant" clone when inserting a new resource, but that only happens (in hot code) inside a let currently_owned = unsafe { self.metadata.contains_unchecked(index) };
if !currently_owned {
clone happens in here
}so... uhh Closing this... |
Related #7856
This removes unnecessary clones of resources which are already owned by the tracker.
Squash.
Edit: ayy funny number