mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 15:30:18 +00:00
Performance improvements for graphing commits
The big improvement is reusing the PBGraphCellInfo (~8-10%)
This commit is contained in:
@@ -74,6 +74,9 @@ NSString * const kGitXCommitType = @"commit";
|
||||
|
||||
- (BOOL)isEqual:(id)otherCommit
|
||||
{
|
||||
if (self == otherCommit)
|
||||
return YES;
|
||||
|
||||
if (![otherCommit isMemberOfClass:[PBGitCommit class]])
|
||||
return NO;
|
||||
|
||||
|
||||
+10
-2
@@ -48,6 +48,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
|
||||
|
||||
PBGitLane *currentLane = NULL;
|
||||
BOOL didFirst = NO;
|
||||
git_oid commit_oid = [[commit sha] oid];
|
||||
|
||||
// First, iterate over earlier columns and pass through any that don't want this commit
|
||||
if (previous != nil) {
|
||||
@@ -57,7 +58,7 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
|
||||
i++;
|
||||
// This is our commit! We should do a "merge": move the line from
|
||||
// our upperMapping to their lowerMapping
|
||||
if ((*it)->isCommit([[commit sha] oid])) {
|
||||
if ((*it)->isCommit(commit_oid)) {
|
||||
if (!didFirst) {
|
||||
didFirst = YES;
|
||||
currentLanes->push_back(*it);
|
||||
@@ -127,7 +128,14 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
|
||||
add_line(lines, ¤tLine, 0, currentLanes->size(), newPos, newLane->index());
|
||||
}
|
||||
|
||||
previous = [[PBGraphCellInfo alloc] initWithPosition:newPos andLines:lines];
|
||||
if (commit.lineInfo) {
|
||||
previous = commit.lineInfo;
|
||||
previous.position = newPos;
|
||||
previous.lines = lines;
|
||||
}
|
||||
else
|
||||
previous = [[PBGraphCellInfo alloc] initWithPosition:newPos andLines:lines];
|
||||
|
||||
if (currentLine > maxLines)
|
||||
NSLog(@"Number of lines: %i vs allocated: %i", currentLine, maxLines);
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
char sign;
|
||||
}
|
||||
|
||||
@property(readonly) struct PBGitGraphLine *lines;
|
||||
@property(assign) struct PBGitGraphLine *lines;
|
||||
@property(assign) int nLines;
|
||||
@property(assign) int position, numColumns;
|
||||
@property(assign) char sign;
|
||||
|
||||
Reference in New Issue
Block a user