-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Performance] Fix array merge in loop to speed up static content deploy #22248
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] Fix array merge in loop to speed up static content deploy #22248
Conversation
Hi @ihor-sviziev. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
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.
@ihor-sviziev if I remember correctly, we have a rule in recently released coding standard for array_merge
in loop. Could you please check?
@ihor-sviziev ok, that's here I saw it: magento/magento-coding-standard#72 (comment) So, standard is just evolving without any connection with reality :) |
Hi @orlangur, thank you for the review. |
✔️ QA passed |
foreach ($result as $path) { | ||
$result = array_merge($result, $this->collectFileMap($path)); | ||
$result[] = $this->collectFileMap($path); |
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.
An integration test is failing with provided changes: \Magento\Deploy\DeployTest
After the short investigation, we found that $path
var can be the type of array and will break the check $this->map[$fileName]
.
Hi @ihor-sviziev , I am closing this PR now due to inactivity. |
Hi @ihor-sviziev, thank you for your contribution! |
Hi @ihor-sviziev. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @ihor-sviziev, thank you for your contribution! |
@ihor-sviziev wazzup?) |
There is an issue that really hard to debug. I don't have free time for now. |
FYI I applied the same change (and fixed it) in the #30153, it already got merged. |
Description (*)
This PR improving static content deploy speed.
For instance i tried to compile Magento/blank theme for 6 different locales (I have all these language packs installed).
Before applying this patch: 109 seconds on my machine.
After applying this patch: 93 seconds on my machine.
If we'll execute for SCD for multiple theme - results should be bigger.
More info about array_merge in loop:
https://github.com/kalessil/phpinspectionsea/blob/master/docs/performance.md#slow-array-function-used-in-loop
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
N/A
Contribution checklist (*)