-
-
Notifications
You must be signed in to change notification settings - Fork 442
Insert cleanup #54
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
Insert cleanup #54
Conversation
Pull Request Test Coverage Report for Build 240
💛 - Coveralls |
Pull Request Test Coverage Report for Build 214
💛 - Coveralls |
20e948f to
dbf7646
Compare
235554f to
c39b21c
Compare
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.
Wow, great PR! Thank you for hard work, seeing Tortoise speeding up little by little in benchmark really feels good.
Also - do you have account on pypi? I would like to add you as maintainer of package
tortoise/backends/base/executor.py
Outdated
|
|
||
| async def execute_insert(self, instance): | ||
| self.connection = await self.db.get_single_connection() | ||
| key = '%s:%s' % (self.db.connection_name, self.model._meta.table) |
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.
Does this kind of formatting gives any significant speedup?
If not, I think following .format() would be better, cause it feels really much more pythonic way
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.
Hmm, no idea.
I tend to use the % formatting over the .format() out of habit.
I just did a quick search, and, yep. that is the only such code in the codebase. I'll change it.
|
Yes, people get excited about performance 😁 |
This branch started with the goal of using prepared statements for inserts, but ended up being a general purpose insert/Client related cleanup.
Work done:
_prepare_insert_columnsand_prepare_insert_valuesnow do what they are calledexecute_insert()methodvaluesas a DB driver parameter (Building prepared statements kayak/pypika#163 is stalled, do something slightly hacky in the interm)(We need to try and get this into pypika, asasyncpgneeds prepared statements to perform well)Not related to inserts:
This should be the last performance-oriented PR from me for now, performance is up over double (and much more for sqlite)