diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-09-14 12:50:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-14 12:50:06 -0400 |
commit | aec294ee0d0f2fa4ccef57085d670b8939de3669 (patch) | |
tree | be1bf0f3786c88287ef814b8434ae720058be1f9 /synapse/metrics | |
parent | Fix typos in comments. (diff) | |
download | synapse-aec294ee0d0f2fa4ccef57085d670b8939de3669.tar.xz |
Use slots in attrs classes where possible (#8296)
slots use less memory (and attribute access is faster) while slightly limiting the flexibility of the class attributes. This focuses on objects which are instantiated "often" and for short periods of time.
Diffstat (limited to 'synapse/metrics')
-rw-r--r-- | synapse/metrics/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py index 2643380d9e..a1f7ca3449 100644 --- a/synapse/metrics/__init__.py +++ b/synapse/metrics/__init__.py @@ -59,7 +59,7 @@ class RegistryProxy: yield metric -@attr.s(hash=True) +@attr.s(slots=True, hash=True) class LaterGauge: name = attr.ib(type=str) @@ -205,7 +205,7 @@ class InFlightGauge: all_gauges[self.name] = self -@attr.s(hash=True) +@attr.s(slots=True, hash=True) class BucketCollector: """ Like a Histogram, but allows buckets to be point-in-time instead of |