Coming from #2313875: Preserve the 'field_type' within FieldInstanceConfig, which tracks the places where we load FieldStorageDefinition objects while in the "ideal" critical path of "entity render with entity cache and render cache hits".

On node/[nid], EntityViewController::view() (page controller for "full entity" pages) does an explicit $entity->title->view('full'), to extract the entity title as page title.

This currently triggers full instantiation of the FieldItemList objects (which in turn requires loading the FieldStorageDefinition objects) for *all* the fields in the entity, just because EntityViewBuilder() does a foreach($entity) to iterate on the fields present in the entity.

This could be avoided alltogether if we iterated on $entity->getFieldDefinitions() instead.

CommentFileSizeAuthor
#1 2314359-optimize_EVB_viewField-1.patch776 bytesyched
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Issue summary: View changes
FileSize
776 bytes

Patch.

amateescu’s picture

Status: Active » Reviewed & tested by the community

If we never use $items in that foreach loop, the patch looks good.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • webchick committed 7041279 on 8.0.x
    Issue #2314359 by yched: Optimization: do not iterate on  fields in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.