Commit a0b8abd95ab for woocommerce
commit a0b8abd95aba20e19c24b72a06e992001c7b08f4
Author: Vladimir Reznichenko <kalessil@gmail.com>
Date: Thu Oct 1 09:11:05 2026 +0200
[Performance] Add perfromance notes for get_available_variations/has_purchasable_variations/build_variation_gallery_entry methods. (#69100)
This PR documents the decision not to engage with the #68272 and #60210 optimizations based on the benchmarks below (the added complexity is not justified by the identified impact).
diff --git a/plugins/woocommerce/includes/class-wc-product-variable.php b/plugins/woocommerce/includes/class-wc-product-variable.php
index 20a09d55b23..d2284a7390d 100644
--- a/plugins/woocommerce/includes/class-wc-product-variable.php
+++ b/plugins/woocommerce/includes/class-wc-product-variable.php
@@ -351,6 +351,7 @@ class WC_Product_Variable extends WC_Product {
_prime_post_caches( $variation_ids );
}
+ // Performance note: meta-based optimization (skipping out-of-stock variations) was evaluated and dismissed due to impact to complexity ratio.
foreach ( $variation_ids as $variation_id ) {
$variation = wc_get_product( $variation_id );
@@ -402,6 +403,8 @@ class WC_Product_Variable extends WC_Product {
* - The transient improves the 95th percentile (P95) load time of the product page by approximately 10%, but does not affect the median.
* - The transient breaks backward compatibility. The woocommerce_is_purchasable filter from \WC_Product::is_purchasable is used by
* extensions to control product purchasability based on user role, membership, geolocation, or login status.
+ *
+ * Meta-based optimization (skipping out-of-stock variations) was evaluated and dismissed due to impact to complexity ratio.
*/
$has_purchasable_variations = false;
$variation_ids = $this->get_children();
diff --git a/plugins/woocommerce/src/Blocks/Utils/ProductGalleryUtils.php b/plugins/woocommerce/src/Blocks/Utils/ProductGalleryUtils.php
index 422cc2a8bab..c5600d36051 100644
--- a/plugins/woocommerce/src/Blocks/Utils/ProductGalleryUtils.php
+++ b/plugins/woocommerce/src/Blocks/Utils/ProductGalleryUtils.php
@@ -422,6 +422,7 @@ class ProductGalleryUtils {
$parent_gallery_ids = array_filter( $parent_gallery_ids, 'wp_attachment_is_image' );
$parent_gallery_extras = array_values( array_diff( $parent_gallery_ids, array( $parent_featured_id ) ) );
+ // Performance note: meta-based optimization (populating images from metas) was evaluated and dismissed due to impact to complexity ratio.
foreach ( $variations as $variation_id ) {
$variation_id = (int) $variation_id;
$entry = self::build_variation_gallery_entry( $variation_id, $parent_featured_id, $parent_gallery_extras );