mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Rukletsov <ruklet...@gmail.com>
Subject Re: Review Request 68224: Augmented `Statistics` to work with any collection.
Date Thu, 09 Aug 2018 13:24:50 GMT


> On Aug. 7, 2018, 11:46 p.m., Benjamin Mahler wrote:
> > Can we just have a single function instead of keeping the specialized TimeSeries
overload? At some point we're going to have to do the copy elimination here so we'll probably
take random access iterators and index directly rather than copying into a vector.

Of course we can, but this will require adding iterator suport for `TimeSeries` which is orthogonal
to this patch. We can't eliminate copying data to the internal vector because we have to modify
it (sort).

If `TimeSeries` had iterator support, we could simply have had the following:
```
template <typename It, typename Accessor>
static Option<Statistics<T>> from(It first, It last, Accessor accessor)
{
  std::vector<T> values;
  values.reserve(std::distance(first, last));

  std::transform(
      first, last, values.begin(), std::back_inserter(values), accessor);

  return from(values);
}
```


- Alexander


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


On Aug. 6, 2018, 10:30 a.m., Alexander Rukletsov wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/68224/
> -----------------------------------------------------------
> 
> (Updated Aug. 6, 2018, 10:30 a.m.)
> 
> 
> Review request for mesos, Benno Evers and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/statistics.hpp e9f1fc23bf83f92a2e7de94dba0df48272cc3394

>   3rdparty/libprocess/src/tests/statistics_tests.cpp a2a780bf9de018c823b68aa48977fd9fd1b8a064

> 
> 
> Diff: https://reviews.apache.org/r/68224/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Alexander Rukletsov
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message