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

[MultidomainBundle] Improve domain based locale router performance #3444

Merged
merged 6 commits into from
Nov 10, 2024

Conversation

dannyvw
Copy link
Contributor

@dannyvw dannyvw commented Oct 8, 2024

Q A
Bug fix? no
New feature? no
BC breaks? yes?
Deprecations? no
Fixed tickets comma separated list of tickets fixed by the PR

This line https://github.com/Kunstmaan/KunstmaanBundlesCMS/blob/7.x/src/Kunstmaan/MultiDomainBundle/Router/DomainBasedLocaleRouter.php#L175 decrease performance when you have many links. The "isMultiLanguage" check is also done inside "getSlugRouteParameters" so it is not necessary to perform that inside the "getRouteCollection" for every link. Runtime checks inside "getRouteCollection" are slow (https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Routing/RouterInterface.php#L29)

We have about 20/25% profit on a page with only a menu and footer.

The only BC break is as the removed methods are overridden. We can solve it maybe with an config setting to switch to the improved router? Is this needed to implement?

Copy link
Member

@acrobat acrobat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you mentioned already, we need to keep BC and can't remove those properties and methods (or change visibility)

I like the performance improvements here, so indeed with some kind of option/toggle would be ideal to make improvements and keep BC. Do you have any numbers on the improvement itself? Like blackfire profile of some timings of real apps?

@acrobat acrobat added this to the 7.2.0 milestone Nov 1, 2024
@dannyvw dannyvw force-pushed the domain-router branch 3 times, most recently from b010a60 to c54dbff Compare November 4, 2024 10:29
@dannyvw
Copy link
Contributor Author

dannyvw commented Nov 4, 2024

@acrobat I pushed some changed. I cannot generate the same blackfire profile as before because we have changed a lot. But the main thing is that is reduced calls to getHost and isMultiLanuage methods.

@dannyvw dannyvw requested a review from acrobat November 8, 2024 12:31
Copy link
Member

@acrobat acrobat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dannyvw small remark regarding the deprecation message and suggested config. Otherwise PR is good to go 👌

@dannyvw dannyvw requested a review from acrobat November 10, 2024 16:53
@acrobat
Copy link
Member

acrobat commented Nov 10, 2024

Thanks @dannyvw!

@acrobat acrobat merged commit b8e9a8b into Kunstmaan:7.x Nov 10, 2024
9 checks passed
@dannyvw dannyvw deleted the domain-router branch November 11, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants