Problem/Motivation

I'm doing some profiling on a site that is batch processing a lot of entities - it's trying to do around 4,000 per request for reasons and has to get several field values from each entity.

In this particular scenario, albeit one that's unusual, the calls to EntityDataDefinition::getDataType() and the functions that method calls account for about 800,000 out of 6 million function calls.

This is very easy to store on a property, so I think we should do that.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3572348

Command icon 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

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review

heddn’s picture

Status: Needs review » Reviewed & tested by the community

A small improvement and I can't think of any downsides.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Test failure looks relevant.

catch’s picture

Status: Needs work » Reviewed & tested by the community

The test failure is because the test is calling ::getDataType() on the first object, and not on the second, which meant the serialized versions were slightly different now that this affects the state of the object.

It would be possible to change the test, but there's no reason to serialize this - we can save the storage space if it ends up in cache, so implemented __sleep().

Since this is a very small change, restoring the RTBC.

longwave’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed efe749343bb to main and 54575357cd6 to 11.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • longwave committed 54575357 on 11.x
    perf: #3572348 Static cache EntityDataDefinition::getDataType()
    
    By:...

  • longwave committed efe74934 on main
    perf: #3572348 Static cache EntityDataDefinition::getDataType()
    
    By:...

Status: Fixed » Closed (fixed)

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