D28946: SearchJob: don't assemble OR term recursively

Daniel Vrátil noreply at phabricator.kde.org
Sat Apr 18 15:51:24 BST 2020


dvratil created this revision.
dvratil added a reviewer: KDE PIM.
Herald added a project: KDE PIM.
Herald added a subscriber: kde-pim.
dvratil requested review of this revision.

REVISION SUMMARY
  The code was ridiculously inefficient for large OR sets. Trying
  to assemble an OR term with 28'000 subterms took minutes and the
  process eventually ran out of memory. Instead just use a for loop
  and a bit of counting to balance the parentheses, the string
  is assembled within milliseconds.

TEST PLAN
  Added a test to make sure the serialized string is the same as before
  
  A benchmark for 10'000 subterms took 4 seconds. Benchmark for 28'000
  subterms got killed by the OOM-killer. After the patch the benchmark
  for 28'000 subterms took 2.2 ms.

REPOSITORY
  R177 PIM: KIMAP

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D28946

AFFECTED FILES
  autotests/searchjobtest.cpp
  src/searchjob.cpp

To: dvratil, #kde_pim
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200418/372eea5c/attachment-0001.html>


More information about the kde-pim mailing list