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

Replace use of ArrayList with List<T> in BamlMapTable for performance #9967

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Contributor

@h3xds1nz h3xds1nz commented Oct 16, 2024

Description

Replaces 4x ArrayList collections with List<T> for improved performance and increased type safety.

I've also introduced init setters for the respective properties so they can be used as part of the Clone operation and the underlying fields can be converted to readonly. Rest are just NULL check removals coming from the as casting pattern or simply redundant as the values in the lists are always from freshly initialized types, no NULLs are inserted.

Sample benchmark showing difference between ArrayList and List<T> with reference type can be found f.e. in #9432.

Customer Impact

Improved performance, cleaner codebase for developers.

Regression

No.

Testing

Local build.

Risk

Low, just type swaps.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners October 16, 2024 13:40
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Oct 16, 2024
@h3xds1nz h3xds1nz changed the title Replace use of ArrayList with List<T> in BamlMapTable Replace use of ArrayList with List<T> in BamlMapTable for performance Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant