----------------------------------------------------------- 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. Changes ------- Added benchmarking results and address Ben's comments. Bugs: MESOS-9325 https://issues.apache.org/jira/browse/MESOS-9325 Repository: mesos Description (updated) ------- 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 (updated) ----- src/common/resources.cpp f0f3df579550d874e477e2d6e7d0e87df079358a src/v1/resources.cpp 4d2b64f6e30ef96b47fc0b72b00158864e245650 Diff: https://reviews.apache.org/r/69032/diff/2/ Changes: https://reviews.apache.org/r/69032/diff/1-2/ Testing (updated) ------- 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