Skip to content

⚡ Performance: Per-address N+1 and nested loops in Multishipping module #40729

@lbajsarowicz

Description

@lbajsarowicz

Performance Issues in Magento_Multishipping

Findings

# File Line(s) Issue Consensus Severity
134 Model/Checkout/Type/Multishipping.php 640-642 N+1 Loading: addressRepository->getById() per address + collectAddressTotals() per address = N shipping method queries. High (Claude+Gemini: Critical, Codex: High)
135 Model/Checkout/Type/Multishipping.php 730-733 Expensive Loop Ops: setCollectShippingRates(true) set per address in loop before single collectTotals(). Medium-High
136 Model/Checkout/Type/Multishipping.php 593, 633, 661 N+1 Loading: Three separate addressRepository->getById() calls in single method instead of single load and reuse. Medium-High
137 Model/Checkout/Type/Multishipping.php 509-512, 521-524 Expensive Loop Ops: Nested loops in setShippingItemsQuotes() calling _addShippingItem() per item-address pair with getQuote() called repeatedly. Medium-High

Methodology

  • Static code analysis cross-validated by 3 AI systems (Claude, Codex gpt-5.4, Gemini 3 Pro)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Ready for Confirmation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions