unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.77k stars 706 forks source link

Generator should cache brush colors #13227

Open Youssef1313 opened 1 year ago

Youssef1313 commented 1 year ago

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:

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.

image

Youssef1313 commented 1 year ago

The colors cache can be shared with BuildColor as well.