Skip to content

Unnecessary recalculation of product list pricing causes huge slowdowns #14941

Closed
@paales

Description

@paales

Preconditions

  1. 2.2.2
  2. PHP 7.0, MySQL 5.6

Steps to reproduce

  1. Create a catalog where prices are including tax + prices are shown including tax.
  2. Go to a category page and show 100 products per page.

Expected result

  1. System does price calculation very efficiently

Actual result

  1. It recalculates the tax while it shouldn't be doing that.

schermafbeelding 2018-05-02 om 14 24 14-1

If we can disable the recalculation of tax we get the following result:
slack-imgs

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:

case self::DISPLAY_TYPE_INCLUDING_TAX:
$res = true;
break;

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.

Metadata

Metadata

Labels

Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passedPartner: Reach DigitalPull Request is created by partner Reach Digitalup for grabs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions