Problem/Motivation

Discovered while working on #2834291: Add a SQL index for entity types that are using EntityPublishedInterface.

Micro-optimisation: Don't parse the entity ID on each iteration in SqlContentEntityStorageSchema::getFieldSchemaData().

Proposed resolution

Get the entity ID once, before iteration.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Status: Active » Needs review
FileSize
1.24 KB

Fix.

claudiu.cristea’s picture

Title: Don't parse entity ID on each iteration in SqlContentEntityStorageSchema::getFieldSchemaData() » Don't parse the entity ID on each iteration in SqlContentEntityStorageSchema::getFieldSchemaData()
Issue summary: View changes
claudiu.cristea’s picture

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

I think the issue title is a bit misleading as there is no "parsing" done, as far as I can tell, the ID is just fetched from a member variable of the entity type. Also it's the entity type ID not the entity ID.

I doubt this brings a measurable benefit, but I don't see any reason not to do this, it certainly doesn't hurt. To me it actually makes things a bit more readable.

claudiu.cristea’s picture

Title: Don't parse the entity ID on each iteration in SqlContentEntityStorageSchema::getFieldSchemaData() » Don't fetch the entity type ID on each iteration in SqlContentEntityStorageSchema::getFieldSchemaData()

Thank you. You're right. I know that it's a micro-micro and, again, micro optimisation. But why not make it :)

alexpott’s picture

Version: 8.2.x-dev » 8.3.x-dev
Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed

There's no bug here. Only eligible for 8.3.x. Committed edbbe39 and pushed to 8.3.x. Thanks!

  • alexpott committed edbbe39 on 8.3.x
    Issue #2834445 by claudiu.cristea: Don't fetch the entity type ID on...

Status: Fixed » Closed (fixed)

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