[PATCH] D55045: Add a version of std::function that includes a few optimizations.

Jordan Soyke via Phabricator reviews at reviews.llvm.org
Thu Dec 6 20:59:33 PST 2018


jsoyke marked an inline comment as done.
jsoyke added inline comments.


================
Comment at: include/functional:1774
+template <typename _Tp>
+using __fast_forward =
+    typename _VSTD::conditional<_VSTD::is_scalar<_Tp>::value, _Tp, _Tp&&>::type;
----------------
This optimization wasn't in the last version, sbenza@ mentioned we might want to do it. It helps with the Invoke benchmarks, as much as 10-20%.

It's probably worth mentioning that this can  hurt performance in cases where the caller is using std::forward, or passing small value types by reference, but these are very uncommon (at least in my experience).


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55045/new/

https://reviews.llvm.org/D55045





More information about the libcxx-commits mailing list