summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-06-19 00:32:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-06-19 00:34:20 -0400
commit699da7ecb96e9e1af8df8072d53199a560311260 (patch)
treed59316fa85f5fce8b6fc25776602de05e6a75f5f /lib/sqlalchemy/engine
parent5624430eb1d07c68d0931bc89f7146bc003fde19 (diff)
downloadsqlalchemy-699da7ecb96e9e1af8df8072d53199a560311260.tar.gz
perf tweaks
- avoid abc checks in distill_20 - ColumnEntity subclasses are unique to their compile state and have no querycontext specific state. They can do a simple memoize of their fetch_column without using attributes, and they can memoize their _getter() too so that it goes into the cache, just like instance_processor() does. - unify ORMColumnEntity and RawColumnEntity for the row processor part, add some test coverage for the case where it is used in a from_statement - do a faster generate if there are no memoized entries - query._params is always immutabledict Change-Id: I1e2dfe607a1749b5b434fc11f9348ee631501dfa
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/util.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/engine/util.py b/lib/sqlalchemy/engine/util.py
index 8fb04646f..fc0260ae2 100644
--- a/lib/sqlalchemy/engine/util.py
+++ b/lib/sqlalchemy/engine/util.py
@@ -8,6 +8,7 @@
from .. import exc
from .. import util
from ..util import collections_abc
+from ..util import immutabledict
def connection_memoize(key):
@@ -85,9 +86,11 @@ _no_kw = util.immutabledict()
def _distill_params_20(params):
+ # TODO: this has to be in C
if params is None:
return _no_tuple, _no_kw, []
- elif isinstance(params, collections_abc.MutableSequence): # list
+ elif isinstance(params, list):
+ # collections_abc.MutableSequence): # avoid abc.__instancecheck__
if params and not isinstance(
params[0], (collections_abc.Mapping, tuple)
):
@@ -99,7 +102,9 @@ def _distill_params_20(params):
return tuple(params), _no_kw, params
elif isinstance(
params,
- (collections_abc.Sequence, collections_abc.Mapping), # tuple or dict
+ (tuple, dict, immutabledict),
+ # avoid abc.__instancecheck__
+ # (collections_abc.Sequence, collections_abc.Mapping),
):
return _no_tuple, params, [params]
else: