From c3f5d517b36d7af11e8f6d6f28309a31412e747f Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Fri, 3 Oct 2008 18:10:43 +0200 Subject: [PATCH] Graphs: use chars to store line number This reduces memory cost somewhat (10MB on the git.git repository), while still keeping the same functionality :) Better would be to use structs in a c array in the cellinfo, as the NSArray and NSObject type information together now use more memory. --- PBGitGraphLine.h | 16 ++++++++-------- PBGitGraphLine.m | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/PBGitGraphLine.h b/PBGitGraphLine.h index 1f7ad60..5ff7806 100644 --- a/PBGitGraphLine.h +++ b/PBGitGraphLine.h @@ -11,14 +11,14 @@ @interface PBGitGraphLine : NSObject { - int upper; - int from; - int to; - int colorIndex; + char upper; + char from; + char to; + char colorIndex; } -@property(readonly) int upper, from, to, colorIndex; -- (id)initWithUpper: (int) u From: (int) f to: (int) t color: (int) c; -+ (PBGitGraphLine*) lowerLineFrom:(int) f to: (int) t color: (int) c; -+ (PBGitGraphLine*) upperLineFrom:(int) f to: (int) t color: (int) c; +@property(readonly) char upper, from, to, colorIndex; +- (id)initWithUpper: (char) u From: (char) f to: (char) t color: (char) c; ++ (PBGitGraphLine*) lowerLineFrom:(char) f to: (char) t color: (char) c; ++ (PBGitGraphLine*) upperLineFrom:(char) f to: (char) t color: (char) c; @end \ No newline at end of file diff --git a/PBGitGraphLine.m b/PBGitGraphLine.m index 85a9f8d..6435e96 100644 --- a/PBGitGraphLine.m +++ b/PBGitGraphLine.m @@ -11,7 +11,7 @@ @implementation PBGitGraphLine @synthesize upper, from, to, colorIndex; -- (id)initWithUpper: (int) u From: (int) f to: (int) t color: (int) c; +- (id)initWithUpper: (char) u From: (char) f to: (char) t color: (char) c; { upper = u; from = f; @@ -20,12 +20,12 @@ return self; } -+ (PBGitGraphLine*) lowerLineFrom:(int) f to: (int) t color: (int) c ++ (PBGitGraphLine*) lowerLineFrom:(char) f to: (char) t color: (char) c { return [[PBGitGraphLine alloc] initWithUpper:0 From:f to:t color:c]; } -+ (PBGitGraphLine*) upperLineFrom:(int) f to: (int) t color: (int) c ++ (PBGitGraphLine*) upperLineFrom:(char) f to: (char) t color: (char) c { return [[PBGitGraphLine alloc] initWithUpper:1 From:f to:t color: c]; }