]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add __slots__ to ioloop._Timeout to reduce memory overhead when there are
authorBen Darnell <bdarnell@beaker.local>
Wed, 24 Mar 2010 00:31:14 +0000 (17:31 -0700)
committerBen Darnell <bdarnell@beaker.local>
Wed, 24 Mar 2010 00:31:14 +0000 (17:31 -0700)
many pending timeouts.

tornado/ioloop.py

index b2a105673fa13579886726f99928460e74976b1c..0d3083efe76ba9a325c7cb5fabd36ecf53181a47 100644 (file)
@@ -297,6 +297,10 @@ class IOLoop(object):
 
 class _Timeout(object):
     """An IOLoop timeout, a UNIX timestamp and a callback"""
+
+    # Reduce memory overhead when there are lots of pending callbacks
+    __slots__ = ['deadline', 'callback']
+
     def __init__(self, deadline, callback):
         self.deadline = deadline
         self.callback = callback