-
Notifications
You must be signed in to change notification settings - Fork 127
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 optimizations for imports of sqlalchemy_utils #357
Comments
Importing functions from slqalchemy_utils directly causes the entire library to get imported, even though many of the library's modules go unused. Using more-focused imports should improve initialization time in performance-sensitive situations. This commit also removes a few unused imports. Closes kvesteri#357
Do you have a flame graph for after? My long-term goal is to get rid of sqlalchemy_utils as a dependency. |
Unfortunately, not on hand: I'd need to vendor the patched dependency and do some profiling. Is that something you'll want before merging the PR? |
@marksteward - I did vendor this with the patch. Unfortunately, I missed that python will still load the |
Thanks, I had a feeling that would be the case! This will need a major release because of breaking changes, but I think we can take the opportunity to simplify some things:
I appreciate this is a bunch of work, so happy to pick up some of these/add tests/have a chat, depending on your preference. |
Since there will be breaking changes anyway...
For my PR, I'm planning to keep the code and functionality as close to what exists as possible. I haven't migrated from sa 1.4 yet, so my vendored version of this needs to keep support. (And I want to avoid the possibility of introducing new bugs by changing up those implementations.) |
After applying the changes from #356 to my vendored copy, initialization time for dropped to about 36ms. (I then ripped out the postgres native_versioning and plugins code that we're not using to get it down to ~13ms.) |
Sorry for not replying, this is fantastic. I'll take a look at landing it this weekend. |
I'm seeing a notable amount of time during application initialization spent loading continuum, and more specifically, packages of sqlalchemy_utils that aren't needed.
I believe that with some more-focused imports, this could be improved.
The text was updated successfully, but these errors were encountered: