D21703: [Transaction] Replace template for functor with std::function
Stefan BrĂ¼ns
noreply at phabricator.kde.org
Mon Jun 10 14:29:35 BST 2019
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190610/ddc1ae3c/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list