Hi, I have a performance problem when running certain ATUM MI features on our rather large inventory.
As I'm sure performance issues need to be documented case by case the one in particular that I've noticed is slow performance in displaying products on the WooCommerce shop page.
The performance penalty is approximately a delay of 0.8 seconds per each product displayed in the shop page. In my particular case, I'm displaying about 12 products per page on the WooCommerce shop page. I have isolated the main issue caused by the
has_product_tree_multi_price which is called by the MultiPrice.php#get_price_html (line 1317). This function is added to the WooCommerce
woocommerce_get_price_html filter to override the HTML that is generated when displaying a price on the front-end:
The current implementation of ATUM MI causes the Shop page to take about 12.15 seconds to load:
To test my theory, I disabled the function of the filter in MultiPrice.php#get_price_html like so:
This same page now loads in 3.47 seconds instead.
I can see that you perform query caching in the
has_product_tree_multi_price function; however, I'm not convinced that it's really being used here when displaying each unique product on the Shop page. From my understanding, the cache is only going to be hit again if the products are rendered multiple times on the same page request. I'm not sure what the best solution to this performance issue would be since I appreciate that the override is happening on
woocommerce_get_price_html so the function must run each time the price is filled as each product is displayed. The only thing I can think of is if it's somehow possible to get the price of all of the products being requested in one single bulk query instead?
Let me know if you have any thoughts or ideas on ways around this performance issue.
For your reference, my database of products contains about 144,061 products. My
atum_product_data database table has about 289,737 rows in it and my
posts table contains 409,045 rows.