-
-
Notifications
You must be signed in to change notification settings - Fork 513
Performance benchmark #2023
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 benchmark #2023
Conversation
932a11b to
edb17bf
Compare
|
@jmikola @malarzm This is ready for now, I made sure to test some examples with embedded documents and references. Right now we check the performance of storing/loading documents as well as hydrating data. These are just basic tests, but I'm hoping that these will help me understand the impact of some of the changes we made in 2.0, but also those suggested in #1908. We'll try to expand the performance test suite in future 2.0 work, but I don't think it's worth holding up 1.3 or 2.0 much longer just because of some tests. |
d9251d8 to
6d390c2
Compare
|
Shall we add |
|
Other than the previous comment this looks awesome! |
|
I noticed we don't have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions, but I'll defer to @malarzm's LGTM.
| use Doctrine\ODM\MongoDB\Hydrator\HydratorInterface; | ||
| use Documents\User; | ||
| use MongoDate; | ||
| use MongoId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is the benchmark for ext-mongo and the adapter, which will be revised after merging this up to master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. I've tested this before in master to see what changes we need and will fix this once merging up to master.
| { | ||
| // Check if the database exists. Calling listCollections on a non-existing | ||
| // database in a sharded setup will cause an invalid command cursor to be | ||
| // returned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't expect anything less from mongos 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that came up when we added tests against a sharded cluster. Took me a while to figure out 🙄
| "autoload": { | ||
| "psr-0": { "Doctrine\\ODM\\MongoDB": "lib/" } | ||
| }, | ||
| "autoload-dev": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this never needed before? Wouldn't the test suite's bootstrap file need to include vendor/autoload.php?
Also, I didn't spot a bootstrap file for the benchmark scripts. Is that because vendor/bin/phpbench knows to include vendor/autoload.php on its own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phpbench configuration uses the same bootstrap file as phpunit, which includes vendor/autoload.php. This change makes the manual adding of namespaces to the loader in said bootstrap file obsolete.
Ironically, I forgot to remove those calls and noticed while double-checking the bootstrap file to confirm that the autoloader is being used. This is now fixed.
6d390c2 to
1fcab90
Compare
Summary
This PR introduces a few basic performance benchmarks to compare the performance of
ext-mongovs.ext-mongodb+mongo-php-adapterin 1.3, and thenext-mongodbnatively in 2.0. For now, we have three benchmarks around storing, loading and hydrating documents. I have yet to understand the reason for the change in https://github.com/doctrine/mongodb-odm/pull/1908/files#diff-2022fc4ba746afe6891859e465c4474bR219 but will add a benchmark for that as well.At the moment, the
BaseBenchclass duplicates code from the PHPUnit bootstrap - not sure if abstracting that makes sense at this time.