[Kde-pim] Review Request: Improve search peformance

Ingo Klöcker kloecker at kde.org
Wed May 20 19:54:25 BST 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/730/#review1164
-----------------------------------------------------------


I suggest to build a list of all ValueListGetters for the fields before you iterate over the contacts. This will reduce the number of ValueListGetter lookups from O(#contacts * #fields) to O(#fields). (A hash lookup might be O(1) under ideal conditions, but the constant might be large, e.g. if the calculation of the hash key is expensive.)

- Ingo


On 2009-05-20 04:07:27, Kevin Krammer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/730/
> -----------------------------------------------------------
> 
> (Updated 2009-05-20 04:07:27)
> 
> 
> Review request for KDE PIM and Tobias Koenig.
> 
> 
> Summary
> -------
> 
> The change to search all values of fields has resulted in a major slowdown of SearchManager::search().
> 
> The elseif string comparison chain is quite obviously the main factor of that, so this patch replaces it with a QHash lookup which maps the label to an appropriate function pointer for getting the field's values.
> 
> 
> Diffs
> -----
> 
>   /trunk/KDE/kdepim/kaddressbook/searchmanager.h 970220 
>   /trunk/KDE/kdepim/kaddressbook/searchmanager.cpp 970220 
> 
> Diff: http://reviewboard.kde.org/r/730/diff
> 
> 
> Testing
> -------
> 
> Primitive benchmarking using QTime::elapsed() indicates the new code is about 10 to 20 times faster, but still quite slower than the original code.
> 
> 
> Thanks,
> 
> Kevin
> 
>

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list