Commit e2ab0615 authored by Richard Braakman's avatar Richard Braakman

[performance] Schedule resolveAddress immediately

resolveAddress requests are done with one query at a time, in
order to correlate the results with the looked-up addresses.
Doing them sequentially via UpdateRequest events added a lot
of overhead in the form of coordination between threads.

This commit creates a dedicated QContactFetchRequest for each
resolveAddress call, so that the events for starting them can
arrive all together in the backend thread and the events
announcing the results can arrive all together in the UI thread.
They will still be processed sequentially, but this change cuts
out the delay between finishing one request and starting the next.

In tests with 10k contacts and a recent contacts list with limit=20,
this reduced the resolve time from 1s to 0.3s.
parent 260da53d
This diff is collapsed.
......@@ -342,6 +342,7 @@ private slots:
void contactIdsAvailable();
void relationshipsAvailable();
void requestStateChanged(QContactAbstractRequest::State state);
void addressRequestStateChanged(QContactAbstractRequest::State state);
void updateContacts();
void contactsAdded(const QList<QContactId> &contactIds);
void contactsChanged(const QList<QContactId> &contactIds);
......@@ -373,7 +374,7 @@ private:
void fetchContacts();
void updateContacts(const QList<QContactId> &contactIds, QList<QContactId> *updateList);
void applyPendingContactUpdates();
void applyContactUpdates(const QList<QContact> &contacts, bool partialFetch, const QSet<QContactDetail::DetailType> &queryDetailTypes);
void applyContactUpdates(const QList<QContact> &contacts, const QSet<QContactDetail::DetailType> &queryDetailTypes);
void resolveUnknownAddresses(const QString &first, const QString &second, CacheItem *item);
bool updateContactIndexing(const QContact &oldContact, const QContact &contact, quint32 iid, const QSet<QContactDetail::DetailType> &queryDetailTypes, CacheItem *item);
......@@ -471,11 +472,11 @@ private:
QString compare;
bool requireComplete;
ResolveListener *listener;
QContactFetchRequest *fetchRequest;
};
QList<ResolveData> m_resolveAddresses;
QList<ResolveData> m_unknownResolveAddresses;
QList<ResolveData> m_unknownAddresses;
const ResolveData *m_activeResolve;
QSet<QString> m_resolvedPhoneNumbers;
QElapsedTimer m_timer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment