Browse Source

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 18 years ago committed by Junio C Hamano
parent
commit
225696af2c
  1. 3
      contrib/gitview/gitview

3
contrib/gitview/gitview

@ -263,6 +263,9 @@ class Commit(object): @@ -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):

Loading…
Cancel
Save