----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/32419/#review77657 -----------------------------------------------------------
src/common/http.cpp <https://reviews.apache.org/r/32419/#comment125809> Just a suggestion for an alternative pattern here. Rather than ``` { JSON::Array array; array.values.reserve(size); /* Fill in array... */ object.values["statuses"] = std::move(array); } ``` How about: ``` { JSON::Array &array = object.values["statuses"]; array.values.reserve(size); /* Fill in array... */ } ``` Seems to me like this code is just as readable and doing no work is better than doing some work. - Michael Park On March 24, 2015, 12:27 a.m., Ben Mahler wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/32419/ > ----------------------------------------------------------- > > (Updated March 24, 2015, 12:27 a.m.) > > > Review request for mesos and Jie Yu. > > > Bugs: MESOS-2353 > https://issues.apache.org/jira/browse/MESOS-2353 > > > Repository: mesos > > > Description > ------- > > This is a simple attempt at improvement for MESOS-2353 in the interim of > writing a more comprehensive JSON benchmark. > > Per the discussion on [r/31700](https://reviews.apache.org/r/31700/), moves > here avoid the very expensive copies of the large JSON objects so long as > variant has move assignment defined (or generated) and our objects have move > generated. > > It appears that variant has move assignment and our json classes can have > move assignment generated, so this should help. > > > Diffs > ----- > > src/common/http.cpp d3b7ca3727567ff252f978720f518ad0912e533b > src/master/http.cpp e1a87d646e9690e39a9e84ae383622018ce80401 > > Diff: https://reviews.apache.org/r/32419/diff/ > > > Testing > ------- > > make check > > No benchmarking performed given the analysis from Michael in > [r/31700](https://reviews.apache.org/r/31700/). I will also be trying this > out on our large production clusters. > > > Thanks, > > Ben Mahler > >