Expect the happy path.
@@ -67,9 +67,9 @@ typename hashtable<Key, Value, Hash, Equal, KeyExtract, Modulator>::iterator
hashtable<Key, Value, Hash, Equal, KeyExtract, Modulator>::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<Key, Value, Hash, Equal, KeyExtract, Modulator>::const_iterat
hashtable<Key, Value, Hash, Equal, KeyExtract, Modulator>::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();
