diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-01-04 01:53:42 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-01-04 01:53:42 -0500 |
| commit | 315db703a63f5fe5fecf6417f78ff513ff091966 (patch) | |
| tree | e7cec92b6fae3c9c0f6e717acaa8fdde5ce780f6 /lib/sqlalchemy/event | |
| parent | b1928d72098dd68c8aba468d94407f991f30d465 (diff) | |
| download | sqlalchemy-slots.tar.gz | |
- start trying to move things into __slots__. This seems to reduce theslots
size of the many per-column objects we're hitting, but somehow the overall memory is
hardly being reduced at all in initial testing
Diffstat (limited to 'lib/sqlalchemy/event')
| -rw-r--r-- | lib/sqlalchemy/event/attr.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/event/base.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/event/registry.py | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/event/attr.py b/lib/sqlalchemy/event/attr.py index be2a82208..5e3499209 100644 --- a/lib/sqlalchemy/event/attr.py +++ b/lib/sqlalchemy/event/attr.py @@ -340,6 +340,8 @@ class _ListenerCollection(RefCollection, _CompoundListener): class _JoinedDispatchDescriptor(object): + __slots__ = 'name', + def __init__(self, name): self.name = name @@ -357,6 +359,8 @@ class _JoinedDispatchDescriptor(object): class _JoinedListener(_CompoundListener): _exec_once = False + __slots__ = 'parent', 'name', 'local', 'parent_listeners' + def __init__(self, parent, name, local): self.parent = parent self.name = name diff --git a/lib/sqlalchemy/event/base.py b/lib/sqlalchemy/event/base.py index 4925f6ffa..37bd2c49e 100644 --- a/lib/sqlalchemy/event/base.py +++ b/lib/sqlalchemy/event/base.py @@ -195,6 +195,8 @@ class Events(util.with_metaclass(_EventMeta, object)): class _JoinedDispatcher(object): """Represent a connection between two _Dispatch objects.""" + __slots__ = 'local', 'parent', '_parent_cls' + def __init__(self, local, parent): self.local = local self.parent = parent diff --git a/lib/sqlalchemy/event/registry.py b/lib/sqlalchemy/event/registry.py index 5b422c401..fc26f91d7 100644 --- a/lib/sqlalchemy/event/registry.py +++ b/lib/sqlalchemy/event/registry.py @@ -140,6 +140,10 @@ class _EventKey(object): """Represent :func:`.listen` arguments. """ + __slots__ = ( + 'target', 'identifier', 'fn', 'fn_key', 'fn_wrap', 'dispatch_target' + ) + def __init__(self, target, identifier, fn, dispatch_target, _fn_wrap=None): self.target = target |
