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

Improve the device detector runtime by wiring the system cache if present #7179

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

xabbuh
Copy link
Contributor

@xabbuh xabbuh commented Oct 18, 2023

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Fixed tickets
Related issues/PRs
License MIT
Documentation PR

What's in this PR?

Use Symfony's system cache pool when it is present to cache data read from YAML files by the device detector.

Why?

The DeviceDetector class scans several YAML files which never change during runtime. This consumes most of the CPU time when e.g. /_sulu_target_group is requested. Caching the parsed result improves this a lot.

@alexander-schranz alexander-schranz changed the title improve the device detector runtime by wiring the system cache if present Improve the device detector runtime by wiring the system cache if present Oct 18, 2023
@alexander-schranz alexander-schranz added the Feature New functionality not yet included in Sulu label Oct 18, 2023
@alexander-schranz
Copy link
Member

Error: Class "DeviceDetector\Cache\PSR6Bridge" not found sounds like we need to increase the matomo device detector version form ^3.7.0 to ^3.9.0

@xabbuh
Copy link
Contributor Author

xabbuh commented Oct 18, 2023

Should I bump the dependency or add a check for the PSR6Bridge class?

@alexander-schranz
Copy link
Member

Would just increase the version to ^3.9, current lowest is already ^3.7 so that is not lot of diff here for people to update.

@alexander-schranz
Copy link
Member

alexander-schranz commented Oct 18, 2023

The PHPStan issue seems to be related that constant_hasser: false is not working correctly here (https://github.com/phpstan/phpstan-symfony#constant-hassers):

constant_hassers: false
So you can currently add that errors to the phpstan baseline.

@xabbuh xabbuh force-pushed the feature/device-detector-cache branch from 4b17d5b to 17a3bc6 Compare October 18, 2023 13:37
@alexander-schranz
Copy link
Member

alexander-schranz commented Oct 18, 2023

Found the issue with phpstan (#7180) and will update the baselines on the target branches so you can ignore them currently.

@xabbuh
Copy link
Contributor Author

xabbuh commented Oct 18, 2023

feel free to ping me when #7180 is merged up and I can rebase here

@alexander-schranz
Copy link
Member

Merged and also merged back to 2.6

@alexander-schranz alexander-schranz added the Performance Problems with performance label Oct 18, 2023
@alexander-schranz alexander-schranz enabled auto-merge (squash) October 18, 2023 14:41
@alexander-schranz alexander-schranz merged commit 8518f00 into sulu:2.6 Oct 18, 2023
7 checks passed
@xabbuh xabbuh deleted the feature/device-detector-cache branch October 18, 2023 14:56
@xabbuh
Copy link
Contributor Author

xabbuh commented Oct 18, 2023

@alexander-schranz Thank you! 👍

@alexander-schranz
Copy link
Member

@xabbuh Thank you for this improvement 👍

@alexander-schranz alexander-schranz added the hacktoberfest-accepted Accepted for hacktoberfest but will be merged later label Oct 19, 2023
mamazu pushed a commit to mamazu/sulu that referenced this pull request Nov 22, 2023
…sent (sulu#7179)

improve the device detector runtime by wiring the system cache if present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New functionality not yet included in Sulu hacktoberfest-accepted Accepted for hacktoberfest but will be merged later Performance Problems with performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants