]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
crimson: avoid seastar::do_with() due to performance reasons.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 17 Oct 2019 22:22:44 +0000 (00:22 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 20 Nov 2019 19:37:45 +0000 (20:37 +0100)
commitea78fa29ae1ce8a359e7c5a3bee1427ab48ebde9
treed5a5bec139125c87b5c54ac13cc4cb74ff0c9e6d
parentf039e3a9d73cc30502c6d89b627b8a26c325ca1a
crimson: avoid seastar::do_with() due to performance reasons.

`seastar::do_with(T&& rvalue, F&& f) takes object for lifetime
extension by rvalue reference. This imposes materialization of
a temporary to move from even when `do_with()` is being called
like:

  `do_with(OpsExecuter{...}, [] { /* ... */)`.

The reason behind that is following language rule:

  "Temporary objects are created when a prvalue is materialized
  so that it can be used as a glvalue, which occurs (since C++17)
  in the following situations:

   * binding a reference to a prvalue"
  (from: "Temporary object lifetime", cppreference.com)

As OpsExecuter is pretty heavy-weight, it is reasonable to avoid
`do_with()` and perform the lifetime extension with smart pointer.
Additional benefit is squeezing plain-to-errorated conversion in
`seastar::internal::do_with_state::get_future()`.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/ops_executer.h
src/crimson/osd/pg.cc