SearchJob: don't assemble OR term recursively
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. Reviewers: #kde_pim, vkrause Reviewed By: #kde_pim, vkrause Subscribers: kde-pim Tags: #kde_pim Differential Revision: https://phabricator.kde.org/D28946
parent
68facf36
Please register or sign in to comment