[Kde-pim] Review Request 121247: Optimize: Reduce the amount of allocations required to build a query.

Daniel Vrátil dvratil at redhat.com
Wed Nov 26 09:10:49 GMT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121247/#review70958
-----------------------------------------------------------

Ship it!


Looks good, thanks!

Stored procedures are a problem, because SQLite does not support them, and MySQL and PostgreSQL stored procedures differ a bit. Also they usually require special privileges, which might not be available when using an external DB server.

The problem with pre-creating some of the queries is, again, that they might slightly differ in different DBs. This is simply the prize we pay for supporting multiple DB backends.


server/src/storage/querybuilder.cpp
<https://git.reviewboard.kde.org/r/121247/#comment49582>

    Use `i + 1 < subConditions.size()` please



server/src/storage/querybuilder.cpp
<https://git.reviewboard.kde.org/r/121247/#comment49584>

    Same here


- Daniel Vrátil


On Nov. 25, 2014, 8:27 p.m., Milian Wolff wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121247/
> -----------------------------------------------------------
> 
> (Updated Nov. 25, 2014, 8:27 p.m.)
> 
> 
> Review request for Akonadi, Daniel Vrátil and Volker Krause.
> 
> 
> Repository: akonadi
> 
> 
> Description
> -------
> 
> The initial implementation of the QueryBuilder was quite naive, when
> you look at the amount of string allocations it does to build the
> final query we sent to the SQL server.
> 
> This was found with Linux perf (no, not even heaptrack!). It
> showed a huge number of cycles spent in malloc/free, all called
> eventually by the QueryBuilder.
> 
> This patch removes most of these allocations. It can further be
> improved in the future, I bet. Also, the amount of queries we create
> is pretty large. I guess using stored procedures or something similar
> might also help the performance. At least, we should try to "remember"
> some of our queries, and make it possible to reuse them in the
> functions that run often.
> 
> 
> Diffs
> -----
> 
>   server/src/storage/querybuilder.h b380f93d8153ebf4581d24da9c820fd0b7b81701 
>   server/src/storage/querybuilder.cpp c07905906bdc712d41007ada753c2d821afd0a2d 
>   server/tests/unittest/querybuildertest.cpp 0aba8a17ad7fb5c35f4b2b3e4366d11061b5329d 
> 
> Diff: https://git.reviewboard.kde.org/r/121247/diff/
> 
> 
> Testing
> -------
> 
> querybuilder test runs, KMail runs - no errors shown on the CLI.
> 
> 
> Thanks,
> 
> Milian Wolff
> 
>

_______________________________________________
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