GNOME Bugzilla – Bug 385078
Optimise e_contact_get
Last modified: 2007-04-05 09:18:22 UTC
e_contact_get is called *a lot*. Its called when sorting contacts, when viewing contacts, when doing pretty much anything. e_contact_get is slow. Not only does it have to do a linear search but every value is bounced via a GValue. This is because e_contact_get() simply called g_object_get_property(), which uses GValues. Attaching a patch so that this is reversed: e_contact_get returns a gpointer, and the get_property() implementation will marshal this into a GValue if required.
Created attachment 78211 [details] [review] Optimse e_contact_get
Can someone please review this patch?
A review of this would be much appreciated. It would not only resolve a major difference between eds-dbus and upstream EDS in e-contact.c, but dramatically speed up e_contact_get_*. Just profile it and you'll see how useful this is.
This patch is best viewed through a graphical diff viewer like meld. It looks like the logic was, for the most part, just swapped between e_contact_get() and the get_property() method. It looks good to me but I'm not very familiar with EBook yet so I'll defer to Srini for the final say.
Yes, that is what happened. _get_property now wraps _get, rather than the other way around (which forced a GValue creation/marshal/destroy onto every access).
Ross, it looks perfectly fine. You rock !! Commit to HEAD.
Committed, thanks!