Actually do the stress test on RCURefCount and make the TLRefCountTest not take 2...
authorChristopher Dykes <cdykes@fb.com>
Sat, 28 Jan 2017 00:45:00 +0000 (16:45 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 28 Jan 2017 00:47:56 +0000 (16:47 -0800)
Summary: Adjusting the iteration count significantly reduces the runtime of the `TLRefCount.Stress` test to ~5 seconds. Working with that same timeframe, we can get away with increasing the iteration count of the (now tested) `RCURefCount.Stress` test to 100k, up from it's previous 10k.

Reviewed By: markisaa

Differential Revision: D4477750

fbshipit-source-id: 6a89dbb65f460655db0cb33926cc331dc1904f1c

folly/experimental/test/RefCountTest.cpp

index 7a6fc8103d2fa68ec1d0f4cd856f71fe8899c3a6..13907ca306a6ee151b775e20c9603085c02d2afa 100644 (file)
@@ -83,10 +83,8 @@ void basicTest() {
 }
 
 template <typename RefCount>
-void stressTest() {
-  constexpr size_t kItersCount = 10000;
-
-  for (size_t i = 0; i < kItersCount; ++i) {
+void stressTest(size_t itersCount) {
+  for (size_t i = 0; i < itersCount; ++i) {
     RefCount count;
     std::mutex mutex;
     int a{1};
@@ -125,10 +123,12 @@ TEST(TLRefCount, Basic) {
 }
 
 TEST(RCURefCount, Stress) {
-  stressTest<TLRefCount>();
+  stressTest<RCURefCount>(100000);
 }
 
 TEST(TLRefCount, Stress) {
-  stressTest<TLRefCount>();
+  // This is absurdly slow, so we can't
+  // do it that many times.
+  stressTest<TLRefCount>(500);
 }
 }