> On March 11, 2015, 9:38 p.m., Ben Mahler wrote:
> > src/master/http.cpp, line 471
> > <https://reviews.apache.org/r/31700/diff/2/?file=888170#file888170line471>
> >
> >     Do you know if a move is helpful here or if the compiler is already 
> > optimizing this?
> >     
> >     ```
> >     object.values["slaves"] = std::move(array);
> >     ```
> >     
> >     Don't do it in this change, we need to measure and I'm just curious :)

I believe the compiler won't optimize this, since `array` is an lvalue and may 
be used after this assignment. One thing how we can try to persuade the 
compiler to move without writing `std::move()` is to wrap array population in a 
function that returns an array, this will be a rvalue then and c++11-capable 
compiler *should* choose the right overload, that takes a rvalue ref: 
http://www.cplusplus.com/reference/map/map/insert/.

But everything more complex than `.reserve()` should be benchmarked, on all 
official supported compilers if possible. I'll play with this when I have some 
free cycles.


- Alexander


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


On March 7, 2015, 1:43 a.m., Alexander Rukletsov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/31700/
> -----------------------------------------------------------
> 
> (Updated March 7, 2015, 1:43 a.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-2353
>     https://issues.apache.org/jira/browse/MESOS-2353
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   src/common/http.cpp 0b57fb01f7769031704e5341849bf95a0197ffd9 
>   src/master/http.cpp b8eef69505b147d4c8a0e005dff545b9fc12a220 
> 
> Diff: https://reviews.apache.org/r/31700/diff/
> 
> 
> Testing
> -------
> 
> make check (OS X 10.9.5, Ubuntu 14.04)
> 
> 
> Thanks,
> 
> Alexander Rukletsov
> 
>

Reply via email to