Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
[libcontacts] Append contacts in batches
Browse files Browse the repository at this point in the history
Although we get better interactivity if the contacts are appended
individually, it becomes considerably slower overall with a large contact
count. Revert to batch append as the lesser of two evils.
  • Loading branch information
matthewvogt committed Dec 21, 2013
1 parent 35da1ee commit a5af87b
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/seasidecache.cpp
Expand Up @@ -2073,23 +2073,21 @@ void SeasideCache::applyPendingContactUpdates()
const bool partialFetch = !detailTypes.isEmpty();

QList<QContact> &appendedContacts((*it).second);
appendContacts(QList<QContact>() << appendedContacts.takeFirst(), type, partialFetch, detailTypes);

if (appendedContacts.isEmpty()) {
m_contactsToAppend.erase(it);

// This list has been processed - have we finished populating the group?
if (type == FilterFavorites && (m_populateProgress != FetchFavorites)) {
makePopulated(FilterFavorites);
qDebug() << "Favorites queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterAll && (m_populateProgress != FetchMetadata)) {
makePopulated(FilterNone);
makePopulated(FilterAll);
qDebug() << "All queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterOnline && (m_populateProgress != FetchOnline)) {
makePopulated(FilterOnline);
qDebug() << "Online queried in" << m_timer.elapsed() << "ms";
}
appendContacts(appendedContacts, type, partialFetch, detailTypes);

m_contactsToAppend.erase(it);

// This list has been processed - have we finished populating the group?
if (type == FilterFavorites && (m_populateProgress != FetchFavorites)) {
makePopulated(FilterFavorites);
qDebug() << "Favorites queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterAll && (m_populateProgress != FetchMetadata)) {
makePopulated(FilterNone);
makePopulated(FilterAll);
qDebug() << "All queried in" << m_timer.elapsed() << "ms";
} else if (type == FilterOnline && (m_populateProgress != FetchOnline)) {
makePopulated(FilterOnline);
qDebug() << "Online queried in" << m_timer.elapsed() << "ms";
}
} else {
QList<QPair<QSet<DetailTypeId>, QList<QContact> > >::iterator it = m_contactsToUpdate.begin();
Expand Down

0 comments on commit a5af87b

Please sign in to comment.