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

Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.


Repository: mesos-git


Description
-------

Instead of creating a Latch each time we create a future, we do it lazily.

No need to create a latch if we don't call Future.await(). Given that 
Future.await() is rare in the code base, we should have a big performance 
improvement. I am attaching the experiment results.

I wrote a simple test:

TEST(Future, Performance)
{
  for (int i = 0; i < 1000000; i++) {
    Promise<bool> promise;
    if (::random() % 2 == 0) {
      promise.set(true);
    } else {
      promise.fail("None");
    }   
  }
}

Summary:
Before the change: 128602 ms
After the change: 2032 ms

<<<<<<<<<<<<<<<<<< Before the change <<<<<<<<<<<<<<<<<

[jyu@smfd-bkq-03-sr4 build]$ 3rdparty/libprocess/tests --gtest_filter=Future.*
Note: Google Test filter = Future.*
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Future
[ RUN      ] Future.Performance
[       OK ] Future.Performance (128602 ms)
[----------] 1 test from Future (128602 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (128603 ms total)
[  PASSED  ] 1 test.

  YOU HAVE 1 DISABLED TEST

<<<<<<<<<<<<<<<<<< After the change <<<<<<<<<<<<<<<<<

[jyu@smfd-bkq-03-sr4 build]$ 3rdparty/libprocess/tests --gtest_filter=Future.*
Note: Google Test filter = Future.*
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Future
[ RUN      ] Future.Performance
[       OK ] Future.Performance (2032 ms)
[----------] 1 test from Future (2032 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (2032 ms total)
[  PASSED  ] 1 test.

  YOU HAVE 1 DISABLED TEST


Diffs
-----

  3rdparty/libprocess/include/process/future.hpp e03f8c9 

Diff: https://reviews.apache.org/r/15190/diff/


Testing
-------

make check

ALL tests passed.


Thanks,

Jie Yu

Reply via email to