Commit 9110eef9 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

Add IOBuf multi create/destroy benchmark

Summary: Add IOBuf multi create/destroy benchmark

Reviewed By: mokomull

Differential Revision: D27406019

fbshipit-source-id: 001cd92743892bb91111831044fc3a4d3b02aaf7
parent fdc64cf0
...@@ -105,20 +105,60 @@ BENCHMARK(takeOwnershipBenchmark, iters) { ...@@ -105,20 +105,60 @@ BENCHMARK(takeOwnershipBenchmark, iters) {
} }
} }
static void createAndDestroyMulti(size_t iters, size_t size) {
static constexpr auto kSize = 1024;
std::array<std::unique_ptr<IOBuf>, kSize> buffers;
while (iters--) {
for (auto i = 0; i < kSize; ++i) {
buffers[i] = IOBuf::create(size);
}
}
}
BENCHMARK_DRAW_LINE();
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 64, 64)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 256, 256)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 1024, 1024)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 4096, 4096)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 5000, 5000)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 5120, 5120)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 8192, 8192)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 10000, 10000)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 10240, 10240)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 16384, 16384)
BENCHMARK_NAMED_PARAM(createAndDestroyMulti, 17000, 17000)
BENCHMARK_DRAW_LINE();
/** /**
* ============================================================================ * folly/io/test:iobuf_benchmark -- --bm_min_iters 100000
* folly/io/test/IOBufBenchmark.cpp relative time/iter iters/s * ============================================================================
* ============================================================================ * folly/io/test/IOBufBenchmark.cpp relative time/iter iters/s
* cloneOneBenchmark 35.52ns 28.15M * ============================================================================
* cloneOneIntoBenchmark 21.60ns 46.29M * createAndDestroy 17.42ns 57.41M
* cloneBenchmark 34.91ns 28.65M * cloneOneBenchmark 23.73ns 42.14M
* cloneIntoBenchmark 22.78ns 43.91M * cloneOneIntoBenchmark 19.08ns 52.40M
* moveBenchmark 10.20ns 98.06M * cloneBenchmark 24.92ns 40.13M
* copyBenchmark 27.31ns 36.62M * cloneIntoBenchmark 21.74ns 45.99M
* cloneCoalescedBaseline 307.72ns 3.25M * moveBenchmark 8.61ns 116.17M
* cloneCoalescedBenchmark 633.34% 48.59ns 20.58M * copyBenchmark 21.23ns 47.11M
* takeOwnershipBenchmark 32.32ns 30.94M * cloneCoalescedBaseline 201.31ns 4.97M
* ============================================================================ * cloneCoalescedBenchmark 555.93% 36.21ns 27.62M
* takeOwnershipBenchmark 36.01ns 27.77M
* ----------------------------------------------------------------------------
* createAndDestroyMulti(64) 32.74us 30.54K
* createAndDestroyMulti(256) 34.08us 29.34K
* createAndDestroyMulti(1024) 36.09us 27.71K
* createAndDestroyMulti(4096) 70.16us 14.25K
* createAndDestroyMulti(5000) 69.27us 14.44K
* createAndDestroyMulti(5120) 79.56us 12.57K
* createAndDestroyMulti(8192) 83.61us 11.96K
* createAndDestroyMulti(10000) 84.54us 11.83K
* createAndDestroyMulti(10240) 83.83us 11.93K
* createAndDestroyMulti(16384) 93.03us 10.75K
* createAndDestroyMulti(17000) 93.85us 10.66K
* ----------------------------------------------------------------------------
* ============================================================================
*/ */
int main(int argc, char** argv) { int main(int argc, char** argv) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment