From: Yedidya Feldblum Date: Mon, 3 Mar 2014 22:33:02 +0000 (-0800) Subject: Fix off-by-one affecting benchmark numbers in folly/io. X-Git-Tag: v0.22.0~661 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a640baa1b296bc03a7c2e44509e7eca92395ef6c;p=folly.git Fix off-by-one affecting benchmark numbers in folly/io. Summary: Fix off-by-one affecting benchmark numbers in folly/io. Test Plan: $ fbconfig -r folly/io/test $ fbmake --fast opt $ _build/opt/folly/io/test/iobuf_cursor_test --benchmark $ _build/opt/folly/io/test/iobuf_network_bench --benchmark Reviewed By: simpkins@fb.com FB internal diff: D1199679 Blame Revision: D344018 --- diff --git a/folly/io/test/IOBufCursorTest.cpp b/folly/io/test/IOBufCursorTest.cpp index d0f369c3..081945a0 100644 --- a/folly/io/test/IOBufCursorTest.cpp +++ b/folly/io/test/IOBufCursorTest.cpp @@ -591,20 +591,20 @@ void runBenchmark() { } BENCHMARK(rwPrivateCursorBenchmark, iters) { - while (--iters) { + while (iters--) { runBenchmark(); } } BENCHMARK(rwUnshareCursorBenchmark, iters) { - while (--iters) { + while (iters--) { runBenchmark(); } } BENCHMARK(cursorBenchmark, iters) { - while (--iters) { + while (iters--) { Cursor c(iobuf_read_benchmark.get()); for(int i = 0; i < benchmark_size ; i++) { c.read(); @@ -614,7 +614,7 @@ BENCHMARK(cursorBenchmark, iters) { BENCHMARK(skipBenchmark, iters) { uint8_t buf; - while (--iters) { + while (iters--) { Cursor c(iobuf_read_benchmark.get()); for(int i = 0; i < benchmark_size ; i++) { c.peek(); diff --git a/folly/io/test/NetworkBenchmark.cpp b/folly/io/test/NetworkBenchmark.cpp index de318818..e320735b 100644 --- a/folly/io/test/NetworkBenchmark.cpp +++ b/folly/io/test/NetworkBenchmark.cpp @@ -31,7 +31,7 @@ size_t buf_size = 0; size_t num_bufs = 0; BENCHMARK(reserveBenchmark, iters) { - while (--iters) { + while (iters--) { unique_ptr iobuf1(IOBuf::create(buf_size)); iobuf1->append(buf_size); for (size_t bufs = num_bufs; bufs > 1; bufs --) { @@ -42,7 +42,7 @@ BENCHMARK(reserveBenchmark, iters) { } BENCHMARK(chainBenchmark, iters) { - while (--iters) { + while (iters--) { unique_ptr iobuf1(IOBuf::create(buf_size)); iobuf1->append(buf_size); for (size_t bufs = num_bufs; bufs > 1; bufs --) { @@ -75,7 +75,7 @@ inline void poolPutIOBuf(unique_ptr&& buf) { } BENCHMARK(poolBenchmark, iters) { - while (--iters) { + while (iters--) { unique_ptr head = std::move(poolGetIOBuf()); for (size_t bufs = num_bufs; bufs > 1; bufs --) { unique_ptr iobufNext = std::move(poolGetIOBuf());