From 66d895a80557a7c91f4bb5ee9835606bb036ed2e Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 17 Jul 2009 17:16:51 +0200 Subject: [PATCH] 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: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/jqueue.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/jqueue.py b/lib/jqueue.py index 743870afe..78199141c 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -80,6 +80,10 @@ class _QueuedOpCode(object): @ivar stop_timestamp: timestamp for the end of the execution """ + __slots__ = ["input", "status", "result", "log", + "start_timestamp", "end_timestamp", + "__weakref__"] + def __init__(self, op): """Constructor for the _QuededOpCode. @@ -152,6 +156,11 @@ class _QueuedJob(object): @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): """Constructor for the _QueuedJob. -- GitLab