diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-11-02 17:37:12 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-11-03 13:56:02 -0500 |
commit | f016c1ac7f93d2f759aff53ec1494658efd7b496 (patch) | |
tree | 83f3e05b83d30c93d1e0beaf175dac38d33f54c7 /lib/sqlalchemy/sql/annotation.py | |
parent | e34886f137a3daf594d34cf5aa9b427de2ad6b98 (diff) | |
download | sqlalchemy-f016c1ac7f93d2f759aff53ec1494658efd7b496.tar.gz |
Reduce import time overhead
* Fix subclass traversals to not run classes multiple times
* switch compiler visitor to use an attrgetter, to avoid
an eval() at startup time
* don't pre-generate traversal functions, there's lots of these
which are expensive to generate at once and most applications
won't use them all; have it generate them on first use instead
* Some ideas about removing asyncio imports, they don't seem to
be too signficant, apply some more simplicity to the overall
"greenlet fallback" situation
Fixes: #5681
Change-Id: Ib564ddaddb374787ce3e11ff48026e99ed570933
Diffstat (limited to 'lib/sqlalchemy/sql/annotation.py')
-rw-r--r-- | lib/sqlalchemy/sql/annotation.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index 8a0d6ec28..94d37573c 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -354,9 +354,5 @@ def _new_annotation_type(cls, base_cls): def _prepare_annotations(target_hierarchy, base_cls): - stack = [target_hierarchy] - while stack: - cls = stack.pop() - stack.extend(cls.__subclasses__()) - + for cls in util.walk_subclasses(target_hierarchy): _new_annotation_type(cls, base_cls) |