diff options
author | Alban Crequy <alban.crequy@collabora.co.uk> | 2011-08-25 23:46:25 +0800 |
---|---|---|
committer | Alban Crequy <alban.crequy@collabora.co.uk> | 2011-08-29 21:12:37 +0800 |
commit | d2d6157547f7d386fea7721b4391b4d0c2b0d79b (patch) | |
tree | 8bb305848cdbefbf9b36c5d16278b4f1775f1b35 /release.py | |
parent | 6a818ee5aced7076786ba0a48a8f32b800b9a676 (diff) | |
download | gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.tar gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.tar.gz gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.tar.bz2 gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.tar.lz gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.tar.xz gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.tar.zst gsoc2013-empathy-d2d6157547f7d386fea7721b4391b4d0c2b0d79b.zip |
contact list: optimize loading contacts
The previous algorithm was O(n^2) with the number of contacts. Each contact can
be in several groups, so when a contact is added or updated, we iterated over
all the contact list to find the rows representing the contact. When connecting
to an account and getting all the contacts, this was too slow.
The groups are stored in the GtkTreeStore and suffer from the same problem: to
look for a group, it needed to iterate on all contacts.
The new algorithm maintains a hash from the contact to the list of rows
representing it, and another hash from the group to the row representing it.
On Empathy 2.30.2 when tested on MeeGo with 300 contacts, loading the contacts
is faster: roughly 9 seconds before the patch, 3 seconds after.
On Empathy 3.1.5, it seems to load in background so I don't know how to measure
the time lost in GtkTreeStore. But before the patch, GProf says 23% is lost in
individual_store_find_contact_foreach(), and after the patch it is not visible
anymore. And "time" says we win 5s of CPU when starting+quitting Empathy:
Before the patch: After the patch:
real 0m23.485s real 0m23.460s
user 0m13.805s user 0m8.305s
sys 0m0.308s sys 0m0.316s
https://bugzilla.gnome.org/show_bug.cgi?id=657086
Diffstat (limited to 'release.py')
0 files changed, 0 insertions, 0 deletions