From: Fredrik Kuivinen Date: Thu, 02 Feb 2006 11:43:35 GMT Subject: [PATCH 2/2] merge-recursive: Speed up commit graph construction Message-ID: <20060202114335.GC8103@c165.ib.student.liu.se> In-Reply-To: <20060202113848.GA8103@c165.ib.student.liu.se> Use __slots__ to speed up construction and decrease memory consumption of the Commit objects. Signed-off-by: Fredrik Kuivinen --- gitMergeCommon.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) 23aa79d4e86761e049bc44b5106cd45355045174 diff --git a/gitMergeCommon.py b/gitMergeCommon.py index ff6f58a..fdbf9e4 100644 --- a/gitMergeCommon.py +++ b/gitMergeCommon.py @@ -107,7 +107,10 @@ def isSha(obj): return (type(obj) is str and bool(shaRE.match(obj))) or \ (type(obj) is int and obj >= 1) -class Commit: +class Commit(object): + __slots__ = ['parents', 'firstLineMsg', 'children', '_tree', 'sha', + 'virtual'] + def __init__(self, sha, parents, tree=None): self.parents = parents self.firstLineMsg = None -- 1.1.6.gc78e-dirty