Caching the members of Colors symbol per-compilation, or even hardcode the colors
The order of operations.
Is it more common to define colors by code (e.g, #ff101010) or by name (e.g, Yellow)?
which of the checks is cheaper?
If the "common" scenario is the same as the "cheap" scenarios. Then definitely this should be the first check. If not, we have to see what is the order that gives us the best performance.
Currently, BuildBrush is responsible for about 4.1% of CPU time in a trace I have while working on SamplesApp and it made the IDE experience a bit sluggish.
BuildBrush
isn't too cheap.https://github.com/unoplatform/uno/blob/e5b91a50ed1e3d469b24f4e67caad1b0c7c8741f/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs#L5099
There are two things to consider:
#ff101010
) or by name (e.g,Yellow
)?Currently,
BuildBrush
is responsible for about 4.1% of CPU time in a trace I have while working on SamplesApp and it made the IDE experience a bit sluggish.