-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Improve bundle load speeds #20877
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 bundle load speeds #20877
Conversation
Hi @thlassche. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @thlassche Thank you for your improvement. I would like you to clarify the following. |
@slavvka I definitely agree with you, however all scenarios will hold: The observer takes the current product from registry (it already did so before my change):
The id of that product is used as cache key for cached instances of the bundle selections, so it will not clash. And to clarify a little bit on the potential gains of this improvement: The observer contains a recursive function ( |
I agree but products in cache may be changed between runs of the observer and already cached products may get invalid in a next run. Since caching is needed only for the current run I would explicitly clear the cache in the beginning of
Yes, now that makes sense for me. Thank you! |
I agree, that's better. Just changed it |
Hi @slavvka, thank you for the review. |
@thlassche thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
When a bundle has a lot of selection, the tax GetPriceConfigurationObserver becomes a real performance hog because it loads the selections over and over again. This fixes that by caching the selection in memory
app/code/Magento/Tax/Test/Unit/Observer/GetPriceConfigurationObserverTest.php
Outdated
Show resolved
Hide resolved
Hi @slavvka, thank you for the review. |
Hi @sidolov, thank you for the review. |
Hi, @thlassche . Your changes in code does't do anything because my debugger don't stop at line 116 when i load a page of bundle product. And this page load time like in 2.3-develop. |
Hi @engcom-Delta, Just tried here with a
Is your Magento configured to display prices including tax? |
@thlassche , i test with display prices including tax. Sorry, but i can't test with debug_print_backtrace because i got this message when i try to clone this PR: "Remote branch EENGCOM-4085-magento-magento2-20877 not found in upstream origin". We have to create new PR. |
✔️ QA passed |
Hi @thlassche, thank you for your contribution! |
Description
When a bundle has a lot of selection, the tax GetPriceConfigurationObserver becomes a real performance hog because it loads the selections over and over again. This fixes that by caching the selection in memory
Manual testing scenarios
Create a bundle with a lot of selections. Check the loading speed of the product page with the bundle before and after this commit. In my local testing scenarios, the loading time went from ~30s to about ~3s