Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Optimization for computing id hashes. #11316

Closed
wants to merge 4 commits into from

Conversation

beberlei
Copy link
Member

@beberlei beberlei commented Feb 28, 2024

In 09b4a75 we introduced an API UnitOfWork::getIdHashByIdentifier that added a significant amount of function calls over the previous inline implode to support backed enums as identifiers.

This PR moves ID hashing into a strategy pattern, moving the object to ClassMetadata instances of each entity, getting the previous performance almost back (+ the dynamic call).

I hope this will significantly improve performance of the 80% identifier that is a simple, single numeric identifier.

Here are the results from two traces compaed with Tideways using the lazy ghost performance project discussed in #11087 that runs EntityManager::getReference, hitting the ID hashing code significantly for 100.000 objects.

Old Call Old Time New Call New Time
UnitOfWork::getIdHashByIdentifier 46.75 ms SingleElementIdHashing::getIdHashByIdentifier 15.3 ms
UnitOfWork::tryGetById 33.01 ms UnitOfWork::tryGetByIdWithClass 16.1 ms
Bildschirmfoto 2024-02-28 um 22 22 28

While not life-changing, this hit accrues, especially in test-suites working with fixtures.

@beberlei
Copy link
Member Author

beberlei commented Mar 2, 2024

Closing in favor of #11332

@beberlei beberlei closed this Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant