changeset 404:e58fe2511a3f

merging_iter: Use a fast path if direction doesn't change. This brings (for iterating) about 7% performance improvement.
author Lewin Bormann <lbo@spheniscida.de>
date Wed, 11 Oct 2017 21:10:53 +0200
parents e06f8508da0c
children 319a27b03734
files src/merging_iter.rs
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/merging_iter.rs	Tue Oct 10 21:50:15 2017 +0200
+++ b/src/merging_iter.rs	Wed Oct 11 21:10:53 2017 +0200
@@ -49,6 +49,10 @@
     /// call was next() or prev(). This basically sets all iterators to one
     /// entry after (Forward) or one entry before (Reverse) the current() entry.
     fn update_direction(&mut self, d: Direction) {
+        if self.direction == d {
+            return;
+        }
+
         let mut keybuf = vec![];
         let mut valbuf = vec![];