Commit ac009d2f authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

A faster empty() shortcut in IOBufCompare

Summary: [Folly] A faster `empty()` shortcut in `IOBufCompare`.

Reviewed By: spalamarchuk

Differential Revision: D9981606

fbshipit-source-id: 4a9762b83fe2f26b1387c162a1e23c201088977f
parent aa554761
......@@ -1072,12 +1072,8 @@ ordering IOBufCompare::impl(const IOBuf& a, const IOBuf& b) const {
for (;;) {
auto ba = ca.peekBytes();
auto bb = cb.peekBytes();
if (ba.empty() && bb.empty()) {
return ordering::eq;
} else if (ba.empty()) {
return ordering::lt;
} else if (bb.empty()) {
return ordering::gt;
if (ba.empty() || bb.empty()) {
return to_ordering(int(bb.empty()) - int(ba.empty()));
}
const size_t n = std::min(ba.size(), bb.size());
DCHECK_GT(n, 0u);
......
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