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.
This commit is contained in:
Pieter de Bie
2008-10-03 18:10:43 +02:00
parent a0f248ef9f
commit c3f5d517b3
2 changed files with 11 additions and 11 deletions
+8 -8
View File
@@ -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
+3 -3
View File
@@ -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];
}