bruns added a comment.
In D21703#477158 <https://phabricator.kde.org/D21703#477158>, @poboiko wrote: > I thought about it myself. I googled it a bit (i.e. here <https://stackoverflow.com/questions/14677997/stdfunction-vs-template>) and saw that there might be some quite unwanted runtime overhead because of using `std::function`. It might be negligible (since we're doing some costly DB operations inside anyways), but I'd prefer if we did some profiling to make sure it's OK. There are two causes mentioned why the template may be faster: 1. the compiler may be able to inline or even remove a trivial template 2. the std::function may need to heap-allocate the space for the bound values (either for captured values of a lambda, or when using std::bind) Neither applies here. (1.) is obviously not the case. (2.) does not apply, as the lambda is bound outside the loop, nothing has to be copied or allocated in the loop. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D21703 To: bruns, #baloo, ngraham, astippich, poboiko Cc: kde-frameworks-devel, LeGast00n, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams