-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50569/#review144542
-----------------------------------------------------------
I updated the commit to the following:
```
commit e1cb01a15e447bdf59cc5ea46870734bebf77033
Author: Guangya Liu <gyliu513@gmail.com>
Date: Tue Aug 2 15:25:22 2016 -0700
Avoid unnecessary validation during resource subtraction.
When subtract resources finished, we need to call `validate` to
check if the scalar resource is negative so as to remove this
resource if it is negative. This is a bit heavy as we only need
to check if a scalar has become negative.
This patch is clarifying the logic by checking if the resource
is a negative scalar directly.
Review: https://reviews.apache.org/r/50569/
```
- Benjamin Mahler
On Aug. 2, 2016, 6:54 a.m., Guangya Liu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50569/
> -----------------------------------------------------------
>
> (Updated Aug. 2, 2016, 6:54 a.m.)
>
>
> Review request for mesos, Benjamin Mahler, Joris Van Remoortere, and Klaus Ma.
>
>
> Bugs: MESOS-5921
> https://issues.apache.org/jira/browse/MESOS-5921
>
>
> Repository: mesos
>
>
> Description
> -------
>
> When subtract resources finished, we need to call `validate` to
> check if the scalar resource is negative so as to remove this
> resource if it is negative. This is a bit heavy as the `validate`
> did many stuffs.
>
> This patch is simpilfying the logic by checking if the resource
> is negative scalar directly.
>
>
> Diffs
> -----
>
> src/common/resources.cpp 309b17626d33bc6b4df07f002b0eea4f4803b3e5
> src/v1/resources.cpp 3f67e32519600a22f07a66ebfe05a7b647cb2c61
>
> Diff: https://reviews.apache.org/r/50569/diff/
>
>
> Testing
> -------
>
> make
> make check
>
> ```
> [==========] Running 3 tests from 1 test case.
> [----------] Global test environment set-up.
> [----------] 3 tests from ResourcesOperators/Resources_BENCHMARK_Test
> [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/0
> Took 222763us to perform 50000 'total += r' operations on cpus(*):1; gpus(*):1; mem(*):128;
disk(*):256
> Took 231983us to perform 50000 'total -= r' operations on cpus(*):1; gpus(*):1; mem(*):128;
disk(*):256
> Took 679121us to perform 50000 'total = total + r' operations on cpus(*):1; gpus(*):1;
mem(*):128; disk(*):256
> Took 698024us to perform 50000 'total = total - r' operations on cpus(*):1; gpus(*):1;
mem(*):128; disk(*):256
> [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/0 (1832 ms)
> [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/1
> Took 22.630349secs to perform 10 'total += r' operations on cpus(0, principal_0, {key_0:
value_0}):1; gpus(...
> Took 22.499543secs to perform 10 'total -= r' operations on cpus(0, principal_0, {key_0:
value_0}):1; gpus(...
> Took 22.566697secs to perform 10 'total = total + r' operations on cpus(0, principal_0,
{key_0: value_0}):1; gpus(...
> Took 22.798371secs to perform 10 'total = total - r' operations on cpus(0, principal_0,
{key_0: value_0}):1; gpus(...
> [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/1 (90621 ms)
> [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2
> Took 2.831782secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
> Took 8935us to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11,
13-14, 16-17, 1...
> Took 2.96492secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5,
7-8, 10-11, 13-14, 16-17, 1...
> Took 9220us to perform 1000 'total = total - r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
> [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 (5817 ms)
> [----------] 3 tests from ResourcesOperators/Resources_BENCHMARK_Test (98270 ms total)
> ```
>
>
> Thanks,
>
> Guangya Liu
>
>
|