mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+8
-8
@@ -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
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user