-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Speedup static content deploy for specific theme #30090
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
Speedup static content deploy for specific theme #30090
Conversation
Hi @ihor-sviziev. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
*/ | ||
private function canDeployTheme(string $theme, array $includedThemesMap, array $excludedEntitiesMap): bool | ||
{ | ||
$includesAllThemes = \array_key_exists('all', $includedThemesMap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using here \array_key_exists
instead of isset
because of optimization php/php-src#3360 that was done in php 7.4, and definitely not in_array because of performance issues.
@magento run all tests |
625607c
to
afbb8be
Compare
@magento run all tests |
Nice! So this will revert the SCD behavior back to how it was in Magento 2.1 from memory. It might cause performance decreases for deploying multiple themes which inherit from the same parent theme (since it might not generate the parent theme files and can't re-use them), but I'm not sure. If that's the case, you can probably first deploy the parent theme followed by the child themes, that should result in the same performance probably. I'm assuming you tested that the resulting generated files are 100% the same as before this change? |
@hostep i didn’t find any difference in result and in performance between generating multiple themes, or single theme |
Cool! Regarding performance, I'm curious if there will be a difference if we have a theme structure like:
Also: should the same change be added to the |
@hostep actually I never used them, might check that if needed, but not sure if it will work for them. |
Maybe not related in scope of this but i'm just curious about the use case magento site setup multiple themes (around 15 themes included magento theme base) and various some locales (2-3 locales). When owner run deploy all theme for 3 locales! No exclude theme specific |
@mrtuvn in this case it will work as it was before ✅ |
How will this affect the build phase for Magento Cloud where we can control what themes are built and what locales? Or will it not have an effect? |
@BarnyShergold unfortunately I don’t have access to ee and magento cloud so can’t check it, but I think it should work fine as it’s basically runs magento static content deploy command with specified list of themes and locales, the only change will be - the only requested themes will be compiled. Could you help to check if it works fine on Magento Cloud? |
@magento create issue |
Hi,
For this configuration
|
Open questions: Backward compatibilityCurrently someone could depends on parent themes, so for these people this change. Possible solutions:
Different behavior between the
|
@ihor-sviziev , as discussed on Slack - option should be good to have to get this change into earlier versions. We can then adjust ECE-Tools to handle this flag and make it configurable through current configs. If this is confirmed working well - in 2.5 what flag does could be adjusted to become a default behavior. |
I agree with the new Regarding the different strategies, I would strongly recommend to try to apply the same change to the The Also: if the change doesn't apply to one or two strategies, the description of this new |
@magento run all tests |
@magento run Functional Tests B2B |
@magento run Functional Tests B2B @gabrieldagama any reasons why this PR isn't getting merged? |
@ihor-sviziev we were having some failed tests that I had suspected could be related to it. I'm trying to deliver it again, hopefully, we will merge it soon. |
Hi @ihor-sviziev, thank you for your contribution! |
Hi guys just curiously how fast we can get with this changes in specific case we have multiple themes + multiple locales in magento cloud? Anyone have benchmark this case |
@mrtuvn sorry, I don't have |
@mrtuvn: I can't speak about cloud, but just about Magento OS 2.4.2-p1 on premise. Last week I did some optimisations to a certain project's deploy flow where we went from 183.5 seconds to 36.5 seconds (only for the SCD commands that is). This was using 2 different frontend themes that both had two levels of parent themes, 4 different locale's got deployed for the frontend and the Magento backend theme only got deployed in one locale. We accomplished this by:
Not sure if these are really helpful numbers, because of the particularities of this project, but it's something 🙂 |
thanks you very much for useful infor |
Btw seem this fix not delivered to 2.3.7! Can it work for 2.3 |
@mrtuvn, we just applied changes from this PR as a patch and using it in 2.3 release line. 👍 |
@magento convert to patch for 2.3.7 |
@mrtuvn changes has been successfully converted for 2.3.7 version and pushed to the converted-magento-magento2-30090-2.3.7 branch. You may submit a pull request using the link: 2.3.7-release...magento:converted-magento-magento2-30090-2.3.7 |
@magento convert to patch for 2.4.1 |
@HenKun an error occurred during the patch generation. |
Description (*)
This PR adds improvement for ability to deploy the only specific theme(s) for multiple locales, so it should improve build phase of deployment for the those who use single theme with different locales.
Basically what I did - i just removed packages from all themes from which inherited requested theme, so in case of Luma - we have only 1 parent theme, but for people who has bigger inheritance - different will be bigger.
How I tested:
Before:
~114 seconds ❌

After:
~60 seconds ✔

Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)
Resolved issues: