Description
Preconditions
- 2.2.2
- PHP 7.0, MySQL 5.6
Steps to reproduce
- Create a catalog where prices are including tax + prices are shown including tax.
- Go to a category page and show 100 products per page.
Expected result
- System does price calculation very efficiently
Actual result
- It recalculates the tax while it shouldn't be doing that.
If we can disable the recalculation of tax we get the following result:
Please note that this is with xdebug enabled, so overal performance is bad over here, but the percentual difference is present with xdebug disabled.
The problem seems to lie in the following method:
magento2/app/code/Magento/Tax/Model/Config.php
Lines 847 to 849 in 9c14af7
The highlighted line should be false
. If we fix that line the calculation time for the price template goes from 4.3 seconds to 1.6 seconds. This means a 2.7 seconds performance improvement.
In the last chart you can still see room for improvement as the final_price.phtml
tempalte still takes 31% of total page load time, while I would expect this to be a lot less. So investigating further still.