Kunstmaan / KunstmaanBundlesCMS

An advanced yet user-friendly content management system, based on the full stack Symfony framework combined with a whole host of community bundles. It provides a full featured, multi-language CMS system with an innovative page and form assembling process, versioning, workflow, translation and media managers and much more.
https://kunstmaancms.be
MIT License
406 stars 188 forks source link

[MultidomainBundle] Improve domain based locale router performance #3444

Closed dannyvw closed 1 week ago

dannyvw commented 1 month ago
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?

dannyvw commented 2 weeks ago

@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.

acrobat commented 1 week ago

Thanks @dannyvw!