folly: improve ProducerConsumerQueueBenchmark (misplaced doNotOptimizeAway)
authorLucian Grijincu <lucian@fb.com>
Tue, 15 Apr 2014 03:15:10 +0000 (20:15 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 18 Apr 2014 19:04:14 +0000 (12:04 -0700)
Summary:
as per discussion from https://phabricator.fb.com/D1274352

After changing the queue length to be a small value (100) I didn't see
improvement from cache alignment of atomics (too much noise). Dropping
that and just fixing the benchmark.

Test Plan: n/a

Reviewed By: ngbronson@fb.com

FB internal diff: D1276591

folly/test/ProducerConsumerQueueBenchmark.cpp

index 52a92518c5b07d6fd0d6a6975e1d0f1ec3556fb7..cea0787461af45ae05ad5e4e2aac2c7d04f774bf 100644 (file)
@@ -72,8 +72,8 @@ struct ThroughputTest {
     for (int i = 0; i < iters_; ++i) {
       ThroughputType item = 0;
       while (!queue_.read(item)) {
-        doNotOptimizeAway(item);
       }
+      doNotOptimizeAway(item);
     }
   }