-
-
Notifications
You must be signed in to change notification settings - Fork 505
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 penalty getClassMetadata #2355
Comments
Thanks for reporting! can you please try it with the Class name resolvers were removed in #2304 (apparently there was cache in the class name resolving)
|
To follow up on this, we do have a few benchmarks for performance critical stuff. @sirian if you feel up for it, you can add a performance test in the As mentioned by @franmomu, this was removed in 2.3.x now that doctrine/persistence can take care of this. When building the new proxy system, I realised that we'd have to make extensive changes to doctrine/persistence to account for the different proxy naming scheme, which I postponed due to the workload involved. I'd expect this to me significantly more efficient in 2.3.x, but in case we do spot performance issues there, we might want to fix them in doctrine/persistence before releasing 2.3.x. Since ODM is the only manager currently proxies other than those from doctrine/common, there's no real performance testing going on of the logic in doctrine/persistence. Please let us know if you're interested in making the changes or if you need help with it. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions. |
I do believe this is fine now with caching in place. |
Problem
Each call to
$documentManager->getClassMetadata($class)
causes ClassMetadataFactory to resolve real class again and again. This causes huge performance penalty when documentManager actively used.mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php
Line 300 in 9ca6f5f
mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php
Line 68 in 9ca6f5f
Tests
I made some tests. 10000 calls to
getClassMetadata
consumes ~14.7msTests with cache
Now I extend DocumentManger and add caching, and run tests again. 10000 iterations consumes 0.76ms (20x times faster!)
The text was updated successfully, but these errors were encountered: