Skip to content
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

Merged
merged 7 commits into from
Sep 17, 2021

Conversation

JulienIgnace-Unity
Copy link
Collaborator

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 :)

@github-actions
Copy link

github-actions bot commented Sep 16, 2021

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.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

HDRP
/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk
With changes to HDRP packages, you should also run
/.yamato%252Fall-lightmapper.yml%2523PR_LightMapper_trunk

SRP Core
You could run ABV on your branch before merging your PR, but it will start A LOT of jobs. Please be responsible about it and run it only when you feel the PR is ready:
/.yamato%252F_abv.yml%2523all_project_ci_trunk
Be aware that any modifications to the Core package impacts everyone in the Graphics repo so please discuss the PR with your lead.

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.

Copy link
Contributor

@arttu-peltonen arttu-peltonen left a 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.

Copy link
Contributor

@FrancescoC-unity FrancescoC-unity left a 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

@JulienIgnace-Unity JulienIgnace-Unity marked this pull request as ready for review September 16, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants