Commit 66d895a8 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add __slots__ on objects in jqueue



Adding slots to _QueuedOpCode decreases memory usage (of these objects)
by roughly four times. It is a lesser change for _QueuedJobs.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 7f5e61b4
...@@ -80,6 +80,10 @@ class _QueuedOpCode(object): ...@@ -80,6 +80,10 @@ class _QueuedOpCode(object):
@ivar stop_timestamp: timestamp for the end of the execution @ivar stop_timestamp: timestamp for the end of the execution
""" """
__slots__ = ["input", "status", "result", "log",
"start_timestamp", "end_timestamp",
"__weakref__"]
def __init__(self, op): def __init__(self, op):
"""Constructor for the _QuededOpCode. """Constructor for the _QuededOpCode.
...@@ -152,6 +156,11 @@ class _QueuedJob(object): ...@@ -152,6 +156,11 @@ class _QueuedJob(object):
@ivar change: a Condition variable we use for waiting for job changes @ivar change: a Condition variable we use for waiting for job changes
""" """
__slots__ = ["queue", "id", "ops", "run_op_index", "log_serial",
"received_timestamp", "start_timestamp", "end_timestamp",
"change",
"__weakref__"]
def __init__(self, queue, job_id, ops): def __init__(self, queue, job_id, ops):
"""Constructor for the _QueuedJob. """Constructor for the _QueuedJob.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment