From fa657beff6662457b6e222a5b7d3add2045d79f1 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 9 Jul 2013 13:55:21 +0100 Subject: [PATCH] [run_set] use lower_bound to skip preceeding entries more quickly. --- persistent-data/run_set.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/persistent-data/run_set.h b/persistent-data/run_set.h index ef8135a..1732896 100644 --- a/persistent-data/run_set.h +++ b/persistent-data/run_set.h @@ -28,10 +28,11 @@ namespace base { run r(r_); if (runs_.size()) { - // Correct but slow - const_iterator it = runs_.cbegin(); - // Skip all blocks that end before r + const_iterator it = runs_.lower_bound(r); + if (it != runs_.begin()) + --it; + while (it != runs_.end() && it->end_ < r.begin_) ++it;