8000 Improve the performance of the RtxtParser. by dellis1972 · Pull Request #9839 · dotnet/android · GitHub
[go: up one dir, main page]

Skip to content

Conversation

dellis1972
Copy link
Contributor
@dellis1972 dellis1972 commented Feb 25, 2025

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 red 8000 uce 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

@dellis1972
Copy link
Contributor Author

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@dellis1972
Copy link
Contributor Author

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

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. This allows us to
   reduce the number of `if` statements in the parser.
@dellis1972 dellis1972 force-pushed the dev/dellis1972/rtxtparseropt branch from 86d1c5b to 7972349 Compare March 3, 2025 12:48
@dellis1972
Copy link
Contributor Author

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@dellis1972 dellis1972 merged commit b07901e into main Mar 3, 2025
59 checks passed
@dellis1972 dellis1972 deleted the dev/dellis1972/rtxtparseropt branch March 3, 2025 15:15
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0