Suggest a possible optimization for static Color GetNamedColor(ReadOnlySpan<char> value)
.
#11846
Labels
area-drawing
Shapes, Borders, Shadows, Graphics, BoxView, custom drawing
proposal/open
t/perf
The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Milestone
(a copy of dotnet/Microsoft.Maui.Graphics#495)
I write this into issue, because I'm not sure we want such optimizations at all.
The discussed method: https://github.com/dotnet/maui/blob/main/src/Graphics/src/Graphics/Color.cs#L757
Now, the method looks like
I found that there is the room for optimization. On my machine the data looks like (PTAL on allocations too):
The benchmark method looks like:
The optimized method:
(the idea taken from from dotnet/roslyn#56374)
Few issues to mention:
If maintainers decides that this approach is fine, few additional points:
Any thoughts? Thanks.
The text was updated successfully, but these errors were encountered: