@@ -96,6 +96,7 @@ - (void) updateCommits:(NSDictionary *)update
96
96
- (void ) walkRevisionListWithSpecifier : (PBGitRevSpecifier*)rev
97
97
{
98
98
NSDate *start = [NSDate date ];
99
+ NSDate *lastUpdate = [NSDate date ];
99
100
NSMutableArray *revisions = [NSMutableArray array ];
100
101
PBGitGrapher *g = [[PBGitGrapher alloc ] initWithRepository: repository];
101
102
std::map<string, NSStringEncoding > encodingMap;
@@ -125,6 +126,9 @@ - (void) walkRevisionListWithSpecifier:(PBGitRevSpecifier*)rev
125
126
126
127
int num = 0 ;
127
128
while (true ) {
129
+ if ([currentThread isCancelled ])
130
+ break ;
131
+
128
132
string sha;
129
133
if (!getline (stream, sha, ' \1 ' ))
130
134
break ;
@@ -200,18 +204,19 @@ - (void) walkRevisionListWithSpecifier:(PBGitRevSpecifier*)rev
200
204
if (isGraphing)
201
205
[g decorateCommit: newCommit];
202
206
203
- if (++num % 1000 == 0 ) {
204
- if ([currentThread isCancelled ])
205
- break ;
206
- NSDictionary *update = [NSDictionary dictionaryWithObjectsAndKeys: currentThread, kRevListThreadKey , revisions, kRevListRevisionsKey , nil ];
207
- [self performSelectorOnMainThread: @selector (updateCommits: ) withObject: update waitUntilDone: NO ];
208
- revisions = [NSMutableArray array ];
207
+ if (++num % 100 == 0 ) {
208
+ if ([[NSDate date ] timeIntervalSinceDate: lastUpdate] > 0.1 ) {
209
+ NSDictionary *update = [NSDictionary dictionaryWithObjectsAndKeys: currentThread, kRevListThreadKey , revisions, kRevListRevisionsKey , nil ];
210
+ [self performSelectorOnMainThread: @selector (updateCommits: ) withObject: update waitUntilDone: NO ];
211
+ revisions = [NSMutableArray array ];
212
+ lastUpdate = [NSDate date ];
213
+ }
209
214
}
210
215
}
211
216
212
217
if (![currentThread isCancelled ]) {
213
218
NSTimeInterval duration = [[NSDate date ] timeIntervalSinceDate: start];
214
- NSLog (@" Loaded %i commits in %f seconds" , num, duration);
219
+ NSLog (@" Loaded %i commits in %f seconds ( %f /sec) " , num, duration, num/ duration);
215
220
216
221
// Make sure the commits are stored before exiting.
217
222
NSDictionary *update = [NSDictionary dictionaryWithObjectsAndKeys: currentThread, kRevListThreadKey , revisions, kRevListRevisionsKey , nil ];
0 commit comments