From: Christopher Dykes <cdykes@fb.com>
Date: Sat, 28 Jan 2017 00:45:00 +0000 (-0800)
Subject: Actually do the stress test on RCURefCount and make the TLRefCountTest not take 2... 
X-Git-Tag: v2017.03.06.00~73
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dc3979b05c81396a6d33f4bbb7759d41f0950f70;p=folly.git

Actually do the stress test on RCURefCount and make the TLRefCountTest not take 2 minutes

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
---

diff --git a/folly/experimental/test/RefCountTest.cpp b/folly/experimental/test/RefCountTest.cpp
index 7a6fc810..13907ca3 100644
--- a/folly/experimental/test/RefCountTest.cpp
+++ b/folly/experimental/test/RefCountTest.cpp
@@ -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);
 }
 }