----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/50557/ -----------------------------------------------------------
(Updated 七月 28, 2016, 9:29 a.m.) Review request for mesos, Benjamin Mahler, Joris Van Remoortere, and Klaus Ma. Bugs: MESOS-5919 https://issues.apache.org/jira/browse/MESOS-5919 Repository: mesos Description ------- The current logic of `Resources::filter` is using `+=` to add the filtered resource object and the `+=` resource object will invoke `validate` which is not necessary as all of the resource objects are valid. The fix is using `add` instead of `+=` for `Resources::filter` , this can make sure there is no validation and can improve performance of `Resources::filter` for resources object. Diffs ----- src/common/resources.cpp 3dbff24d6859d3b1ed8589cec50170a5202cfbcb src/v1/resources.cpp 3c85dc8aa8125962b44e60806ece83a7653d0dc7 Diff: https://reviews.apache.org/r/50557/diff/ Testing (updated) ------- make make check The performance for `ports` resources of `r.nonRevocable()` was improved about `8s` with 1000 operations. Before fix with validation. ``` [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 Took 2.832429secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 22.034252secs to perform 1000 'total.contains(r)' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 3.628885secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 3.113548secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 3.854608secs to perform 1000 'total = total - r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 8.517941secs to perform 1000 'r.nonRevocable()' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 (43985 ms) ``` After fix without validation. ``` [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 Took 2.834335secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 21.828846secs to perform 1000 'total.contains(r)' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 3.689858secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 2.962259secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 3.760281secs to perform 1000 'total = total - r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... Took 125159us to perform 1000 'r.nonRevocable()' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 (35204 ms) ``` Thanks, Guangya Liu