Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize RouteTableFactory.DetectAmbiguous routes #56415

Merged
merged 7 commits into from
Jul 5, 2024

Conversation

andrewjsaid
Copy link
Contributor

Make RouteTableFactory.DetectAmbiguous faster using a hash table after it was reported as slow in #55114

Description

I've added a performance benchmark to the code with the routes found in https://github.com/IgniteUI/igniteui-blazor-examples as reported in original ticket. I am unsure as to whether that's appropriate please advise if I must change them.

Before

Method Mean Error StdDev Op/s Gen 0 Gen 1 Gen 2 Allocated
CreateRouteTable 223.1 ms 4.32 ms 6.05 ms 4.482 1000.0000 333.3333 - 749 MB

After

Method Mean Error StdDev Op/s Gen 0 Gen 1 Gen 2 Allocated
CreateRouteTable 3.889 ms 0.0629 ms 0.0588 ms 257.1 7.8125 - - 6 MB

Fixes #55114

@andrewjsaid andrewjsaid requested a review from a team as a code owner June 24, 2024 00:33
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Jun 24, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 24, 2024
@andrewjsaid
Copy link
Contributor Author

With new benchmark (dynamically generated routes) on latest commit I have these numbers.

Before

|           Method |     Mean |   Error |  StdDev |  Op/s |     Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------------- |---------:|--------:|--------:|------:|----------:|------:|------:|----------:|
| CreateRouteTable | 208.6 ms | 3.92 ms | 3.66 ms | 4.794 | 1000.0000 |     - |     - |    619 MB |

After

|           Method |     Mean |     Error |    StdDev |  Op/s |  Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------------- |---------:|----------:|----------:|------:|-------:|------:|------:|----------:|
| CreateRouteTable | 5.226 ms | 0.1043 ms | 0.1356 ms | 191.3 | 7.8125 |     - |     - |      7 MB |

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jul 4, 2024
@javiercn javiercn merged commit 2291eaf into dotnet:main Jul 5, 2024
26 checks passed
@javiercn
Copy link
Member

javiercn commented Jul 5, 2024

@andrewjsaid thanks for the contribution!

@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview7 milestone Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DetectAmbiguousRoutes on RouteTableFactory doesn't scale well with large number of routes
4 participants