Problem/Motivation
LayoutBuilderBuildSubscriber::onBuildRender calls $block->access() on every FieldBlock before checking whether the block actually uses the field_fallback_formatter formatter. On layouts with many field blocks this runs an access check per block for nothing; only blocks configured with the fallback formatter need it.
Depending on the number of blocks in the layout and the cost of the access check, this can save anywhere from a little to a lot of per-request rendering time.
Steps to reproduce
Render an entity via Layout Builder with several FieldBlock components; observe $block->access() being called for blocks not using the fallback formatter.
Proposed resolution
Move the formatter-type check (and the mandatory-config check) above the $block->access() call.
Remaining tasks
?
User interface changes
None
API changes
None
Data model changes
None
Issue fork field_fallback_formatter-3594163
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
herved commented