-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60003/#review179373
-----------------------------------------------------------




3rdparty/libprocess/include/process/deferred.hpp
Line 77 (original), 79 (patched)
<https://reviews.apache.org/r/60003/#comment254039>

    This is more a question than an issue. Do we plan to forward functor 
references through `_Deferred`, hence the use of `std::forward<F>()` here 
instead of `std::move()`?
    
    Carrying a functor reference is unsafe. `template <typename F> _Deferred<F> 
defer(F&&)` overload silently captures references to lvalues in 
`_Deferred<F&>`. But as long as `_Deferred` is immediately used for conversion 
to `Deferred` or `std::function` it should be fine.



3rdparty/libprocess/include/process/deferred.hpp
Lines 83-88 (original), 85-90 (patched)
<https://reviews.apache.org/r/60003/#comment254283>

    Can we eliminate more copyings here? `f_` is captured by value by lambda 
and then passed as a `const` to `dispatch`. We can make the lambda `mutable` 
and `move()` captured `f_`. Or, for example, we could store `f` value and `pid` 
in a structure, that will be captured by a `std::shared_ptr`.



3rdparty/libprocess/include/process/dispatch.hpp
Lines 203-205 (patched)
<https://reviews.apache.org/r/60003/#comment254244>

    Style: `Dispatcher` internals are overindented. Here and in other places 
where it's defined.


- Ilya Pronin


On June 15, 2017, 8:32 a.m., Dmitry Zhuk wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60003/
> -----------------------------------------------------------
> 
> (Updated June 15, 2017, 8:32 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, haosdent huang, James Peach, and 
> Michael Park.
> 
> 
> Bugs: MESOS-7713
>     https://issues.apache.org/jira/browse/MESOS-7713
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Reduced copying in defer, dispatch and Future.
> 
> This reduces number of copies made for each parameter in a code like this:
> future.then(defer(pid, &SomeProcess::someMethod, param1, param2));
> 
> For the objects that do not support move semantics (e.g. protobuf messages), 
> number of copies is reduced from 8-10 to 6. If move semantics is supported, 
> then number of copies is reduced from 6-7 to 1 if parameter is passed with 
> std::move, or 2 otherwise.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/defer.hpp 
> 7f3369e723cb244e97930621cbba89cf7873567d 
>   3rdparty/libprocess/include/process/deferred.hpp 
> e446621be11ac51f5f91c417cc8975e363c2f715 
>   3rdparty/libprocess/include/process/dispatch.hpp 
> 3a0793888dc0df5e3ec31b06f47cd920c71e0db9 
>   3rdparty/libprocess/include/process/future.hpp 
> cce950509f58022e79bb51a6e72ea1a005b9cb50 
>   3rdparty/libprocess/include/process/http.hpp 
> f637999174d92a98208b5fc49a65f9929efb11a0 
> 
> 
> Diff: https://reviews.apache.org/r/60003/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> Number of copies was checked by using defer to subscribe process for Future 
> callbacks, and passing parameters that count number of copies made.
> 
> 
> Thanks,
> 
> Dmitry Zhuk
> 
>

Reply via email to