Commit 57e517a5 authored by Stepan Palamarchuk's avatar Stepan Palamarchuk Committed by Facebook Github Bot 0

Remove unnecessary construction of IOBuf in Cursor

Summary: This assignment is unnecessary, because in `for` loop we **always** call `cloneOneInto` that would assign another IOBuf to that IOBuf.

Reviewed By: alikhtarov

Differential Revision: D3215861

fb-gh-sync-id: ad87b99848aaae79f0870d49e0474f1abf0f28e5
fbshipit-source-id: ad87b99848aaae79f0870d49e0474f1abf0f28e5
parent dcac5e8d
......@@ -324,8 +324,6 @@ class CursorBase {
}
size_t cloneAtMost(folly::IOBuf& buf, size_t len) {
buf = folly::IOBuf();
std::unique_ptr<folly::IOBuf> tmp;
size_t copied = 0;
for (int loopCount = 0; true; ++loopCount) {
......
......@@ -76,6 +76,16 @@ BENCHMARK(skipBenchmark, iters) {
}
}
BENCHMARK(cloneBenchmark, iters) {
folly::IOBuf out;
while (iters--) {
Cursor c(iobuf_read_benchmark.get());
for (int i = 0; i < benchmark_size; ++i) {
c.clone(out, 1);
}
}
}
// fbmake opt
// _bin/folly/experimental/io/test/iobuf_cursor_test -benchmark
//
......
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