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 product edit page loading speed #37477

Conversation

densen45
Copy link
Contributor

@densen45 densen45 commented May 9, 2023

Description (*)

Page loading speed for products with many custom options or bundle products with multiple options with many selections is slow.
The more custom options a product has and the more options and selections a bundle product has, the slower the speed becomes.

In the issue addressed below, several experiences were shared about how slow this can get.

With the changes included in this Pull Request, I was able to reduce the page load time for one of my bundle products (10 options, approx. 160 selections in total) from about 1min 20sec to 35sec.

Related Pull Requests

https://github.com/magento-gl/magento2-page-builder/pull/53

Fixed Issues (if relevant)

  1. Fixes [Performance] Slow product edit page with big amount of custom options #29409

Manual testing scenarios (*)

  1. Create a bundle product with one option and add one selection
  2. Load the edit page and measure the time until the page becomes fully responsive (JavaScript finishes)
  3. Add more options (about 5) and several selections (about 20) to each option
  4. Load the page and measure the time again

Another scenario would be to add more and more custom options to a product and note that it takes longer to load the edit page.

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)

Dennis Schmitz added 2 commits May 9, 2023 08:23
…rver.js to improve the page load performance for product edit pages.
…dom-observer.js to improve the page load performance for product edit pages.
@m2-assistant
Copy link

m2-assistant bot commented May 9, 2023

Hi @densen45. Thank you for your contribution!
Here are some useful tips on 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
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-community-project m2-community-project bot added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels May 9, 2023
@m2-community-project m2-community-project bot added this to Pending Review in Pull Requests Dashboard May 9, 2023
@densen45
Copy link
Contributor Author

densen45 commented May 9, 2023

@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 message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@mrtuvn mrtuvn added Area: Perf/Frontend All tickets related with improving frontend performance. Area: Performance and removed Area: Perf/Frontend All tickets related with improving frontend performance. labels May 9, 2023
@ihor-sviziev
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, Static Tests, WebAPI 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 message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Hi @densen45,
Looks like your changes caused regression according to functional test results. Could you please double-check it?

@densen45
Copy link
Contributor Author

densen45 commented May 22, 2023

Hey @ihor-sviziev,
the error (it's the same for all three functional test suites) refers to the PageBuilder. Unfortunately I don't have an environment running PageBuilder to check this.

Can someone else please check this?

@m2-community-project m2-community-project bot moved this from Changes Requested to Ready for Testing in Pull Requests Dashboard May 24, 2023
@ihor-sviziev
Copy link
Contributor

So for now I'm approving pull request, and someone please help with fixing test failures

@engcom-Lima
Copy link
Contributor

@magento run all tests

@engcom-Echo
Copy link
Contributor

@magento run WebAPI Tests,Functional Tests B2B

@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 message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run WebAPI 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 message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B

@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 message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

WebAPI Tests failure are not related to PR. Functional Tests B2B failure are different on last two run on same commit.
Functional Tests B2B
Run1
Screenshot 2023-09-08 at 11 01 42 AM

Run2
Screenshot 2023-09-08 at 11 01 46 AM

Hence moving to merge in progress

@engcom-Echo engcom-Echo self-assigned this Sep 8, 2023
@m2-community-project m2-community-project bot moved this from Extended testing (optional) to Ready for Testing in Community Dashboard Sep 8, 2023
@engcom-Echo engcom-Echo moved this from Ready for Testing to Extended testing (optional) in Community Dashboard Sep 8, 2023
@engcom-Echo engcom-Echo moved this from Extended testing (optional) to Merge in Progress in Community Dashboard Sep 8, 2023
@magento-devops-reposync-svc magento-devops-reposync-svc merged commit 10d15b0 into magento:2.4-develop Oct 20, 2023
10 of 12 checks passed
@engcom-Charlie engcom-Charlie moved this from Merge in Progress to Recently Merged in Community Dashboard Oct 23, 2023
@Nuranto
Copy link
Contributor

Nuranto commented Dec 8, 2023

@densen45 We just applied your fix, and it makes a huge difference (loading time divided by more than 3 in our test case). All our backend team and myself thank you for that !

@Nuranto
Copy link
Contributor

Nuranto commented Dec 12, 2023

Bad news, the fix actually breaks one of my forms. I'm investigating, and keep you informed.

@Nuranto
Copy link
Contributor

Nuranto commented Dec 12, 2023

@densen45 Got it :

Capture d’écran 2023-12-12 à 14 37 55

With foreach, the return was terminating the foreach callback function. But now with for it's terminating the whole processAdded function. Should be a break.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Dec 12, 2023

@Nuranto, can you please create pull request for this change?
BTW, after this change, still you'll have approximately the same performance? Looks like it might revert approximately to what was in the past

@Nuranto
Copy link
Contributor

Nuranto commented Dec 12, 2023

Done. Will ask my team for more tests with this bug fixed. But @densen45 was saying that this one was not the most valuable change of the PR. So I guess it won't change much from our previous results.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Apr 16, 2024

@densen45 unfortunately, this change caused a regression, see #38622 (related fixes #38276 #38623).
I believe after fixing it, we won't see any performance improvements anymore :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Performance help wanted Priority: P3 May be fixed according to the position in the backlog. Progress: accept Project: Community Picked PRs upvoted by the community Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Community Dashboard
Recently Merged
Development

Successfully merging this pull request may close these issues.

[Performance] Slow product edit page with big amount of custom options
9 participants