From f82e693a31d07ab8b391888ff60eb7ff5b95bd13 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Thu, 16 May 2019 15:20:19 -0700 Subject: [PATCH] RangeDelAggregator::StripeRep::Invalidate() to be skipped if empty (#5312) Summary: RangeDelAggregator::StripeRep::Invalidate() clears up several vectors. If we know there isn't anything to there, we can safe these small CPUs. Profiling shows that it sometimes take non-negligible amount of CPU. Worth a small optimization. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5312 Differential Revision: D15380511 Pulled By: siying fbshipit-source-id: 53c5f34c33b4cb1e743643c6086ac56d0b84ec2e --- db/range_del_aggregator.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/range_del_aggregator.h b/db/range_del_aggregator.h index e593807d5..ce7897a97 100644 --- a/db/range_del_aggregator.h +++ b/db/range_del_aggregator.h @@ -320,8 +320,10 @@ class RangeDelAggregator { RangeDelPositioningMode mode); void Invalidate() { - InvalidateForwardIter(); - InvalidateReverseIter(); + if (!IsEmpty()) { + InvalidateForwardIter(); + InvalidateReverseIter(); + } } bool IsRangeOverlapped(const Slice& start, const Slice& end);