Skip to content

[Issue] Cache the results of isCacheable calls to improve performance #40156

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #40112: Cache the results of isCacheable calls to improve performance


This function call is relatively expensive when $elements has the full layout in it. Especially the PageCache module is calling this function a lot from the following places:

  • Magento\PageCache\Model\Layout\LayoutPlugin
  • Magento\PageCache\Observer\ProcessLayoutRenderElement

On my local machine I've seen the impact to be anywhere between 20-40 milliseconds, when the page has been loaded a few times to warm up cache (config, block, layout, etc...), but FPC is circumvented.

We could also opt to move this to the PageCache module, but I think it is ok to optimize this within the Layout class within the framework.

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P3May be fixed according to the position in the backlog.

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions