Wrapped tight loops inside a transaction to dramatically speedup things

Monotone-Parent: 4d37ced4d18a580dd453377f39144a265c8580cf
Monotone-Revision: 34186beb96b4e03796e53fcc658539fd1c3dbb8a

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2011-08-31T18:11:09
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2011-08-31 18:11:09 +00:00
parent a3fd4f2c5e
commit defb3e67dc
2 changed files with 10 additions and 1 deletions

View File

@ -226,6 +226,8 @@
max = [fetchResults count];
if (max > 0)
{
ldb_transaction_start([[self context] connectionInfo]->oc_ctx);
for (count = 0; count < max; count++)
{
result = [fetchResults objectAtIndex: count];
@ -260,7 +262,9 @@
lastModificationDate = cLastModified;
}
}
ldb_transaction_commit([[self context] connectionInfo]->oc_ctx);
if (foundChange)
{
ti = [NSNumber numberWithDouble: [now timeIntervalSince1970]];

View File

@ -496,6 +496,9 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
fetchResults
= [fetchResults sortedArrayUsingFunction: _compareFetchResultsByMODSEQ
context: NULL];
ldb_transaction_start([[self context] connectionInfo]->oc_ctx);
for (count = 0; count < max; count++)
{
result = [fetchResults objectAtIndex: count];
@ -519,6 +522,8 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
lastModseq = modseq;
}
ldb_transaction_commit([[self context] connectionInfo]->oc_ctx);
ti = [NSNumber numberWithDouble: [now timeIntervalSince1970]];
[currentProperties setObject: ti
forKey: @"SyncLastSynchronisationDate"];