From e4feb3b3cd7f4eaa6036305c9720746397fa6def Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 22 Dec 2017 13:55:07 +0100 Subject: Expect the happy path. --- vespalib/src/vespa/vespalib/stllike/hashtable.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/stllike/hashtable.hpp b/vespalib/src/vespa/vespalib/stllike/hashtable.hpp index ada3f455017..57e8dcc4b03 100644 --- a/vespalib/src/vespa/vespalib/stllike/hashtable.hpp +++ b/vespalib/src/vespa/vespalib/stllike/hashtable.hpp @@ -67,9 +67,9 @@ typename hashtable::iterator hashtable::find(const Key & key) { next_t h = hash(key); - if (_nodes[h].valid()) { + if (__builtin_expect(_nodes[h].valid(), true)) { do { - if (_equal(_keyExtractor(_nodes[h].getValue()), key)) { + if (__builtin_expect(_equal(_keyExtractor(_nodes[h].getValue()), key), true)) { return iterator(this, h); } h = _nodes[h].getNext(); @@ -83,9 +83,9 @@ typename hashtable::const_iterat hashtable::find(const Key & key) const { next_t h = hash(key); - if (_nodes[h].valid()) { + if (__builtin_expect(_nodes[h].valid(), true)) { do { - if (_equal(_keyExtractor(_nodes[h].getValue()), key)) { + if (__builtin_expect(_equal(_keyExtractor(_nodes[h].getValue()), key), true)) { return const_iterator(this, h); } h = _nodes[h].getNext(); -- cgit v1.2.3