Skip to content

[Performance] Fix array_merge in a loop #33904

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

Conversation

ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Aug 25, 2021

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] [Performance] Fix array_merge in a loop #33929: [Performance] Fix array_merge in a loop

@m2-assistant
Copy link

m2-assistant bot commented Aug 25, 2021

Hi @ihor-sviziev. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

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.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 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

@ihor-sviziev ihor-sviziev changed the title Fix array_merge in loop [Pefrormance] Fix array_merge in loop Aug 25, 2021
@ihor-sviziev
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

3 similar comments
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

Copy link
Contributor

@andrewbess andrewbess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ihor-sviziev
Thank you for your contribution.
Great job.
Could you please update branch?
Thank you in advance.

@ihor-sviziev ihor-sviziev changed the title [Pefrormance] Fix array_merge in loop [Performance] Fix array_merge in a loop Aug 25, 2021
@ihor-sviziev
Copy link
Contributor Author

@magento create issue

Copy link
Contributor

@Den4ik Den4ik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ihor-sviziev Good job 👍

@magento-engcom-team
Copy link
Contributor

Hi @Den4ik, thank you for the review.
ENGCOM-9203 has been created to process this Pull Request
✳️ @Den4ik, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa
Copy link
Contributor

Hi @ihor-sviziev Thanks for your collaboration and contribution!
As part of QA process, I will be just require the steps to execute the to validate the performance improvements.
Could you please help me providing detailed steps to reproduce the case?

@ihor-sviziev
Copy link
Contributor Author

Hi @engcom-Alfa,
This is a performance improvement for the code generation step. It should positively affect the setup:di:compile time on magneto installations with a lot of extensions

@engcom-Alfa
Copy link
Contributor

Hi @ihor-sviziev , @tanghongtanghong , @andrewbess , @Den4ik , @dudzio12
Thanks for the collaboration & contribution!

❌ QA not Passed

di:compile command performance needs to be reduced

Manual Scenario Steps

  1. Installed a fresh Magento 2.4-develop and installed a couple of extensions eg- Braintree and SMTP
  2. Upgraded the Magento and make sure that the extensions are installed properly.
  3. Executed the di:compile command and noted the execution time.

✔️ Expected result After Fix

  • Currently the execution time of the command taking 40 seconds with the extensions; Expected to reduce the execution time ~10% at least.

❌ Actual result After Fix

  • After applying the PR changes; the execution time is being same as ~40 seconds;
    Screenshot 2021-11-09 at 4 55 05 PM

Kindly take a look at above details and recommend if there is any information will help by any chance please!

Copy link
Contributor

@engcom-Alfa engcom-Alfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes if required as per above comment
Thanks

@Den4ik
Copy link
Contributor

Den4ik commented Nov 10, 2021

@engcom-Alfa It's don't provide huge performance increase, but this PR decrease count of merge function calls that is good point for me.

2021-11-10-16-18-49@2x

@engcom-Dash
Copy link
Contributor

@engcom-Alfa It's don't provide huge performance increase, but this PR decrease count of merge function calls that is good point for me.

2021-11-10-16-18-49@2x

Hi @Den4ik
In order to count the total number of functions call which tool you are using. Could you please suggest so that we can use the same.

@ihor-sviziev
Copy link
Contributor Author

@engcom-Dash, this is https://www.blackfire.io/

@Den4ik
Copy link
Contributor

Den4ik commented Jan 6, 2022

Hi @engcom-Dash
It's blackfire https://blackfire.io/

@engcom-Dash
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Run the blackfire profiler on magento2.4-develop with command ‘blackfire run bin/magento se:di:co’
  2. Run the blackfire profiler on PR barnch with command ‘blackfire run bin/magento se:di:co’
  3. compare both the profile on blackfire.

Before: ✖️ The count of array merge function is high

Screenshot 2022-01-11 at 5 28 17 PM

After: ✔️ The count of array merge function has been significantly reduced.

Screenshot 2022-01-11 at 5 27 29 PM (1)

FYI .. To Configure blackfire in system follow the below link:
https://blackfire.io/docs/up-and-running/installation

@engcom-Charlie
Copy link
Contributor

It seems that bot moved this PR to Changes Requested from Merge in Progress, so moving it back.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Setup Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Release Line: 2.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] [Performance] Fix array_merge in a loop