-
-
Notifications
You must be signed in to change notification settings - Fork 393
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 tuning #51
Conversation
I also cleared up a few lint warnings.
Pull Request Test Coverage Report for Build 201
💛 - Coveralls |
tortoise/backends/asyncpg/client.py
Outdated
@@ -172,7 +173,7 @@ def acquire_connection(self): | |||
async def commit(self): | |||
try: | |||
await self.transaction.commit() | |||
except asyncpg.exceptions._base.InterfaceError as exc: | |||
except (AttributeError, asyncpg.exceptions._base.InterfaceError) as exc: |
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.
What is the case here? You managed to catch it without transaction?
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 was because the linter (correctly) complained that it was possible for self.transaction
to not exist. Which is now forcefully set to None instead. AttributeError is if it is a None value.
I should probably make it clearer? Or is it perferred for it to raise a NPE?
Now that I think of it, a NPE would point out that something happened that should never be able to happen...
tortoise.models.__init__
restructure give 25-30% speedup in select benchmark.Usage of
pypika>=0.15.6
gives 53% speedup in insert benchmark.I also cleared up a few lint warnings.
As per findings in https://github.com/tortoise/orm-benchmarks
(The benchmark is currently only using SQLite, but both these changes should be generic)