KEMBAR78
Remove use of `string.Split` from reflection by MichalStrehovsky · Pull Request #95952 · dotnet/runtime · GitHub
Skip to content

Conversation

@MichalStrehovsky
Copy link
Member

Saves 1.2% on a Hello World. dotnet new console --aot && dotnet publish /p:OptimizationPreference=Size is now under 1 MB.

This is actually also a throughput optimization, not just size optimization.

Cc @dotnet/ilc-contrib

Saves 1.2% on a Hello World. `dotnet new console --aot && dotnet publish /p:OptimizationPreference=Size` is now under 1 MB.

This is actually also a throughput optimization, not just size optimization.
@ghost
Copy link

ghost commented Dec 13, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Saves 1.2% on a Hello World. dotnet new console --aot && dotnet publish /p:OptimizationPreference=Size is now under 1 MB.

This is actually also a throughput optimization, not just size optimization.

Cc @dotnet/ilc-contrib

Author: MichalStrehovsky
Assignees: MichalStrehovsky
Labels:

area-NativeAOT-coreclr

Milestone: -

@Suchiman
Copy link
Contributor

For best throughput you should probably move the collection literal out of the loop as it otherwise constructs an inline array on every iteration

@jkotas
Copy link
Member

jkotas commented Dec 13, 2023

For best throughput

This would be an optimization on average only if there are more types with at least two attributes than there are types with no attributes.

In any case, it would be very minor optimization, if at all. Constructing the inline array is very cheap. I think it is fine as-is for better readability.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jkotas jkotas merged commit 265db9e into dotnet:main Dec 13, 2023
@MichalStrehovsky MichalStrehovsky deleted the stringsplit branch December 13, 2023 21:26
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants