From 97f58b785d6c5c86b52a365b0086b5b098f5ee97 Mon Sep 17 00:00:00 2001 From: Fredrik Kuivinen Date: Thu, 2 Feb 2006 12:43:35 +0100 Subject: [PATCH] merge-recursive: Speed up commit graph construction Use __slots__ to speed up construction and decrease memory consumption of the Commit objects. Signed-off-by: Fredrik Kuivinen Signed-off-by: Junio C Hamano --- gitMergeCommon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitMergeCommon.py b/gitMergeCommon.py index ff6f58a07..fdbf9e477 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 -- 2.26.2