-
Notifications
You must be signed in to change notification settings - Fork 418
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
Use code generation to further accelerate simple persistence operations #116
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backed by unit tests.
… easier to extend (WIP)
…it easier to extend (end)
…bindings. This is necessary to let Oracle, for instance, use bindParam() instead of bindValue() for CLOBs.
…reparation depending on the platform
…k() to allow preSelect() hook to be called just like the other model hooks. This refactoring allows the turbo behavior to accelerate findPk() on every model, even those using a preSelect() hook. It also harmonizes the AR and Query apis: just like ActiveRecord::save() calls doInsert() or doUpdate(), ActiveQuery::find() calls doSelect(), and ActiveQuery::count() calls doCount().
This is to accomodate cases where PK columns have special bindings (like timestamps... ot blobs, who knows). I took advantage of this to refactor the custom binding code in the adapters.
The behavior now only accelerates doInsert() (until we find a way to marge this into the core, too).
And now that there is nothing in the turbo behavior, it is removed. doInsert() acceleration is disabled on Mssql platforms, due to very exotic bindings in adapter classes
Passing the script by reference is a bad habit, but not doing so for only a few methods is confusing. In the future, if a refactoring of the builders occurs, let us not reproduce that mistake
Awesome ! [william@MBP:~/projects/php-orm-benchmark-read-only]
% php TestRunner.php
| Insert | findPk | complex| hydrate| with |
|--------|--------|--------|--------|--------|
PDOTestSuite | 132 | 125 | 96 | 123 | 108 |
Propel14TestSuite | 1973 | 720 | 158 | 453 | 454 |
Propel15TestSuite | 1820 | 854 | 221 | 583 | 670 |
Propel16TestSuite | 570 | 259 | 223 | 604 | 687 |
Doctrine12TestSuite | 3269 | 5176 | 840 | 3283 | 3185 |
Doctrine12WithCacheTestSuite | 3540 | 2404 | 857 | 1802 | 1322 |
Doctrine2TestSuite | 257 | 845 | 267 | 1142 | 615 | (MBP 2,4GHz - 4GO RAM - HDD) Propel 1.6 without this improvement:
And with it:
|
willdurand
added a commit
that referenced
this pull request
Sep 28, 2011
Use code generation to further accelerate simple persistence operations
willdurand
pushed a commit
that referenced
this pull request
Sep 9, 2013
willdurand
added a commit
that referenced
this pull request
Sep 9, 2013
Fixes #116 - remove type + un-necessary code
richmulhern
pushed a commit
to AriaSystems/Propel
that referenced
this pull request
Jun 4, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By leveraging code generation to replace runtime introspection, this patch boosts simple persistence operations:
The patch is backwards compatible with the current code. In particular, it doesn't use buildtime generation when it's not possible:
The same idea can be applied to more operations (update, delete, deleteAll), but the "turbo" branch should be merged before it's too big ;)
As usual, comments are welcome.