Skip to content

Optimization patch: product configurable attribute collection _loadPrices function #90

Closed
@do-m-en

Description

@do-m-en

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions