gitview: Define __slots__ for Commit

Define __slots__ for the Commit class. This reserves space in each Commit
object for only the defined variables. On my system this reduces heap usage
when viewing a kernel repo by 12% ~= 55868 KB.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Michael Ellerman 2007-05-30 14:47:09 +10:00 committed by Junio C Hamano
parent 709b148a90
commit 225696af2c
1 changed files with 3 additions and 0 deletions

View File

@ -263,6 +263,9 @@ class Commit(object):
""" This represent a commit object obtained after parsing the git-rev-list
output """

__slots__ = ['children_sha1', 'message', 'author', 'date', 'committer',
'commit_date', 'commit_sha1', 'parent_sha1']

children_sha1 = {}

def __init__(self, commit_lines):