> On Oct. 16, 2018, 5:24 p.m., Benjamin Mahler wrote:
> > Can you also post the filter benchmark results?
> > 
> > https://github.com/apache/mesos/blob/1.7.0/src/tests/resources_tests.cpp#L3865-L3920

Done.


> On Oct. 16, 2018, 5:24 p.m., Benjamin Mahler wrote:
> > src/common/resources.cpp
> > Line 1550 (original), 1550 (patched)
> > <https://reviews.apache.org/r/69032/diff/1/?file=2098158#file2098158line1550>
> >
> >     Consider reserving the result vector?

Good point.


> On Oct. 16, 2018, 5:24 p.m., Benjamin Mahler wrote:
> > src/common/resources.cpp
> > Line 1555 (original), 1555 (patched)
> > <https://reviews.apache.org/r/69032/diff/1/?file=2098158#file2098158line1555>
> >
> >     Probably warrants a comment about why we just add it to the vector 
> > instead of adding?

Done.


- Meng


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


On Oct. 18, 2018, 9:22 p.m., Meng Zhu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/69032/
> -----------------------------------------------------------
> 
> (Updated Oct. 18, 2018, 9:22 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Gastón Kleiman.
> 
> 
> Bugs: MESOS-9325
>     https://issues.apache.org/jira/browse/MESOS-9325
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently, `Resources::filter()` operation uses `add()` which
> scans the resources vector, a O(n) operation. This is not
> necessary. `filter()` operation should only remove `Resource`
> entries. This patch optimizes the performance by directly
> `push_back` the resource to the vector without scanning.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp f0f3df579550d874e477e2d6e7d0e87df079358a 
>   src/v1/resources.cpp 4d2b64f6e30ef96b47fc0b72b00158864e245650 
> 
> 
> Diff: https://reviews.apache.org/r/69032/diff/2/
> 
> 
> Testing
> -------
> 
> make check
> 
> # Benchmarking:
> 
> ## Before
> 
> [ RUN      ] Resources_Filter_BENCHMARK_Test.Filters
> Took 29.29123ms to perform 50000 'r.nonRevocable()' operations on cpus:1; 
> gpus:1; mem:128; disk:256
> Took 7.129952ms to perform 50000 'r.revocable()' operations on cpus{REV}:1
> Took 28.54168ms to perform 50000 'r.unreserved()' operations on cpus:1; 
> gpus:1; mem:128; disk:256
> Took 36.282329ms to perform 50000 'r.reserved(role)' operations on 
> cpus(reservations: [(STATIC,role)]):1; gpus(reservations: [(STATIC,role)]):1; 
> mem(reservations: [(STATIC,role)]):128; disk(reservations: 
> [(STATIC,role)]):256
> [       OK ] Resources_Filter_BENCHMARK_Test.Filters (101 ms)
> 
> ## After
> 
> [ RUN      ] Resources_Filter_BENCHMARK_Test.Filters
> Took 9.518106ms to perform 50000 'r.nonRevocable()' operations on cpus:1; 
> gpus:1; mem:128; disk:256
> Took 4.33245ms to perform 50000 'r.revocable()' operations on cpus{REV}:1
> Took 8.500219ms to perform 50000 'r.unreserved()' operations on cpus:1; 
> gpus:1; mem:128; disk:256
> Took 15.63636ms to perform 50000 'r.reserved(role)' operations on 
> cpus(reservations: [(STATIC,role)]):1; gpus(reservations: [(STATIC,role)]):1; 
> mem(reservations: [(STATIC,role)]):128; disk(reservations: 
> [(STATIC,role)]):256
> [       OK ] Resources_Filter_BENCHMARK_Test.Filters (38 ms)
> 
> 
> Thanks,
> 
> Meng Zhu
> 
>

Reply via email to