Skip to content

Conversation

@h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Jun 6, 2024

Description

Optimizes GetStandardValues function from TypeConverter by replacing ArrayList with preallocated array as we know the size beforehand, removes unnecessary allocations caused by copying the list and re-allocating the internal array.

Removes the private helper function GetProperties that's only used in 1 place, inlining it instead.

Method Mean Error StdDev Median Gen0 Allocated
GetStandardValues 560.4 ns 11.12 ns 15.21 ns 555.2 ns 0.0677 1136 B
GetStandardValues_PR 455.9 ns 9.11 ns 16.88 ns 447.2 ns 0.0315 528 B

Customer Impact

Improved performance, reduced allocations.

Regression

No.

Testing

Method functionality test, build.

Risk

None.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested a review from a team as a code owner June 6, 2024 18:39
@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 Jun 6, 2024
@h3xds1nz h3xds1nz changed the title [CursorConverter.cs] Replace ArrayList with preallocated array and reduce allocations Replace ArrayList in CursorConverter with preallocated array and reduce allocations Sep 1, 2024
@harshit7962
Copy link
Member

@h3xds1nz Thank you for your contributions.

@h3xds1nz
Copy link
Member Author

h3xds1nz commented Oct 1, 2024

@harshit7962 Thanks for including them.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

5 participants