Skip to content

⚡ Performance: N+1 loading and missing caching in Catalog module #40700

Description

@lbajsarowicz

Performance Issues in Magento_Catalog

Static code analysis identified the following performance anti-patterns in the Catalog module. Severity ratings are cross-validated by three independent AI reviewers (Claude, Codex gpt-5.4, Gemini 3 Pro).

Findings

# File Line(s) Issue Consensus Severity
1 Model/CategoryList.php 83-86 N+1 Loading: categoryRepository->get() called per category ID in loop after collection->getData(). Should use batch getList() with SearchCriteria. Critical (Claude+Gemini: Critical, Codex: High)
2 Model/ProductRepository.php 728-738 N+1 Loading: readExtensions->execute() called per product after collection load. Extension attributes loaded one-by-one. High (Claude+Gemini: High, Codex: Medium)
4 Model/Config.php 205, 274 Full Collection Load: _setCollectionFactory->create()->load() and _groupCollectionFactory->create()->load() without addFieldToSelect. Loads all columns for attribute sets/groups. Medium
7 Model/ProductRepository.php 242 Memory Issue: Product cache with configurable limit (default 1000) but no eviction policy. Can grow unbounded in long-running processes. Medium

Methodology

  • Static code analysis with grep + file reads against 8 anti-pattern categories
  • Cross-validated by 3 AI systems independently
  • Runtime profiling with PHP-SPX recommended before implementing fixes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions