mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 50553: Used `subtract` instead of `-=` for `Resources::contains`.
Date Fri, 29 Jul 2016 20:36:24 GMT

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


Ship it!




Ship It!

- Benjamin Mahler


On July 28, 2016, 9:30 a.m., Guangya Liu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50553/
> -----------------------------------------------------------
> 
> (Updated July 28, 2016, 9:30 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::contains` is using `-=` to remove
> the contained 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 `subtract` instead of `-=` for `Resources::contains`
> , this can make sure there is no validation and can improve
> performance of `Resources::contains` for resources object.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 3dbff24d6859d3b1ed8589cec50170a5202cfbcb 
>   src/v1/resources.cpp 3c85dc8aa8125962b44e60806ece83a7653d0dc7 
> 
> Diff: https://reviews.apache.org/r/50553/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> The performance for `ports` resources of `total.contains(r)` was improved about `9s`
with 1000 operations.
> 
> Before fix with validation.
> ```
> [ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2
> Took 2.705859secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
> Took 30.612245secs to perform 1000 'total.contains(r)' operations on ports(*):[1-2, 4-5,
7-8, 10-11, 13-14, 16-17, 1...
> Took 3.532576secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
> Took 2.902233secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5,
7-8, 10-11, 13-14, 16-17, 1...
> Took 3.608806secs 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 (43364 ms)
> [----------] 3 tests from ResourcesOperators/Resources_BENCHMARK_Test (193001 ms total)
> ```
> 
> After fix without validation.
> ```
> [ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2
> Took 2.899972secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
> Took 21.577654secs to perform 1000 'total.contains(r)' operations on ports(*):[1-2, 4-5,
7-8, 10-11, 13-14, 16-17, 1...
> Took 3.580736secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8,
10-11, 13-14, 16-17, 1...
> Took 3.028626secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5,
7-8, 10-11, 13-14, 16-17, 1...
> Took 3.699126secs 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 (34789 ms)
> ```
> 
> 
> Thanks,
> 
> Guangya Liu
> 
>


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