Description
Function app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php(132) Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection->_loadPrices()
has poor performance (I tested it in cart - magento 1.6.1.0 - but it hasn't changed consideraby from that version to current Magento 2 version) so I optimised it a bit.
I am not certain whether I made somekind of a mistake since the performance gain is fairly big so I'd appriciate a review of the patch before I apply it in production.
Major differences in calls to child functions (for 2 configurable and 1 simple product in cart) - output from xhprof:
Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection::getProduct: 11,036 before and 4 calls after
Mage_Catalog_Model_Product_Type_Configurable::getUsedProducts: 5,518 before and 2 calls after
Mage_Catalog_Model_Product::getTypeInstance: 5,518 before and 2 calls after
--- patch for magento 1.6.1.0 to 1.7.0.1 ---
see the comment below
--- patch for magento 2 (this patch wasn't tested) ---
see the comment below
Regards,
Domen Vrankar