Page MenuHomePhabricator

Use std::unordered_set instead of std::vector in IsEvicted()
ClosedPublic

Authored by PiRK on Feb 3 2022, 15:17.

Details

Summary

An unordered set can tell if an element is present in ~O(1) time (constant on
average, worst case linear to the size of the container), which speeds up and
simplifies the lookup in IsEvicted().

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

This is a backport of core#20197 [3/6]
https://github.com/bitcoin/bitcoin/pull/20197/commits/ca63b53ecdf377ce777fd959d400748912266748
Depends on D10976

Test Plan

ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable