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

Performance issue #109

Open
GSpecDrum opened this issue Sep 7, 2021 · 3 comments
Open

Performance issue #109

GSpecDrum opened this issue Sep 7, 2021 · 3 comments

Comments

@GSpecDrum
Copy link

GSpecDrum commented Sep 7, 2021

I have performance issues with migrating from liip/theme-bundle to SyliusThemeBundle.

vendor version
PHP 7.4.12
Symfony/Symfony 4.4.15
Sylius/SyliusThemeBundle 2.2.0
sonata-project/SonataAdminBundle 3.76

Our project has more than 3 themes and we are using SonataAdminBundle. It has many twig template calls to rendering small blocks.

As a result, Sylius\Bundle\ThemeBundle\Twig\ThemeFilesystemLoader::locateTemplate is called more than 200 times per request.

Inside this method HierarchicalTemplateLocator rotating through all themes and all themed locators for each twig render call. It tooks very long time for such frequent calls.

In total, requests fall in timeout.

I have profiler screenshots to show my case (dev environment):

image
2 themes is configured

image
7 themes configured

one more screen - for CRUD list action, 2 themes configured:
image

Based on the above, for now I can't using this bundle for my project. I don't understand why this bundle is recommended to replacing for liip/theme-bundle.

@Roshyo
Copy link

Roshyo commented Mar 21, 2022

Indeed it loops a lot, but still the performances showed here are terrible compared to the ones I get.
With 4 themes enabled, 4800 times on the CompositeTemplateLocator but the Sylius home page still loads in 750ms approx. And the render time was 0.1094 seconds. So clearly acceptable, even more since this whole thing will get cached once the production mode will be enabled (once on prod mode, it reaches 0.0390 seconds of rendering time)

Are you sure it is not rather related to your environment ?

In any case, do you have some solution in mind ?

@GSpecDrum
Copy link
Author

GSpecDrum commented Jun 12, 2022

Yes, it is related to environment, like I said. On dev environment it is terribly worse than on production.

About solution - I recommend to look how it was done in liip/theme-bundle. There was caching mechanism to not call locateTemplate for each time when template is rendering.

@mario-fehr
Copy link

mario-fehr commented Jun 28, 2022

Probably related to #70 and #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants