Skip to content

Commit daf5792

Browse files
authored
Merge pull request #590 from evoskuil/master
Avoid unnecessary duplicate search when sieve is negative.
2 parents 4ec1f23 + 8dbd6f9 commit daf5792

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

include/bitcoin/database/impl/primitives/hashmap.ipp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,16 @@ inline bool CLASS::put(bool& duplicate, const memory_ptr& ptr,
378378
return false;
379379

380380
if (previous.is_terminal())
381+
{
382+
duplicate = false;
381383
ncounter_.fetch_add(one, std::memory_order_relaxed);
384+
}
382385
else
386+
{
387+
duplicate = !first(ptr, previous, key).is_terminal();
383388
pcounter_.fetch_add(one, std::memory_order_relaxed);
389+
}
384390

385-
duplicate = !first(ptr, previous, key).is_terminal();
386391
return true;
387392
}
388393

0 commit comments

Comments
 (0)