Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2834445-2.patch | 1.24 KB | claudiu.cristea |
Comments
Comment #2
claudiu.cristeaFix.
Comment #3
claudiu.cristeaComment #4
claudiu.cristeaComment #5
tstoecklerI 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.
Comment #6
claudiu.cristeaThank you. You're right. I know that it's a micro-micro and, again, micro optimisation. But why not make it :)
Comment #7
alexpottThere's no bug here. Only eligible for 8.3.x. Committed edbbe39 and pushed to 8.3.x. Thanks!