You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve the performance of the RtxtParser. (#9839)
* Improve the performance of the RtxtParser.
There are some small improvements in the RtxtParser that can be done to improve the performance of the parser. This commit includes the following changes:
1. Update the `enum` to be `byte`. This saves us a few bytes per instance.
2. Reorder the fields to reduce padding.
3. Encode is a type is a stylable into the `RType` enum.
4. Pre-allocate the array so we reduce the number of allocations.
The following table shows the improvements for 10000 items. We have to use a large number to
see the improvements. Note that the default Maui template has about 7000 entries in the R.txt file.
So this is not an unreasonable test size.
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated |
|------------------- |---------:|---------:|---------:|----------:|----------:|---------:|----------:|
| RtxtParserBaseLine | 53.40 ms | 0.315 ms | 0.246 ms | 7500.0000 | 3000.0000 | 300.0000 | 67.32 MB |
| RtxtParser | 48.58 ms | 0.192 ms | 0.179 ms | 7454.5455 | 2454.5455 | 272.7273 | 60.44 MB |
0 commit comments