-
Notifications
You must be signed in to change notification settings - Fork 772
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
Improvements to the DynamicArray class #5685
Conversation
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. HDRP SRP Core Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
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.
Looks great! I recommend just making the QuickSort change to keep the API consistent and make the method more discoverable via autocomplete.
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.
LGTM except a small perf improvement that can be done
Purpose of this PR
This PR adds a few utility APIs to the DynamicArray class. The goal is to provide a serviceable replacement for List when allocations are not allowed. ICollection interface allocates all over the place, in foreach, Sort etc and in some critical code that can be called every frame, we can't afford that.
Testing status
Automated tests have been added for all APIs.
Comments to reviewers
Added @arttu-peltonen for a Core SRP perspective on this.
Also, the QuickSort was implemented as a separate static function to avoid the requirement of IComparable for ALL dynamic arrays. Not super happy with that so if anyone has a more elegant solution I'm all for it :)