-
Notifications
You must be signed in to change notification settings - Fork 41
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
Optimize imports #604
Labels
enhancement
New feature or request
Comments
Hi @danielgafni! Thanks for making a framegraph! I've never done this optimization. Is it like moving all the imports to the code using it? elif is_numpy_array(c):
from .numpy import deserialize_numpy_array_direct
res = deserialize_numpy_array_direct(c, o) |
Yes exactly. If you need them for type annotations, you can do the following: from typing import TYPE_CHECKING
if TYPE_CHECKING: # will NOT be executed at runtime
import numpy as np
def my_func(arg: "np.ndarray"):
... |
Looks good! Would you be able to contribute to pyserde? 🙂 |
Maybe! I'm short on time right now but it should improve in a few weeks |
awesome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've noticed
pyserde
contributes a fair share to my CLI app import time flamegraph (I'm usingpyserde
for app configuration so it has to be imported at top level).Here is the breakdown for
pyserde
:It's really nothing to worry about, but I guess dependencies like
numpy
andsqlalchemy
could be imported in a lazy fashion in order to further improve import times.This flamegraph can be made with tuna.
The text was updated successfully, but these errors were encountered: