diff options
author | William Casarin <jb55@jb55.com> | 2020-05-01 20:03:43 -0700 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-09-29 09:40:10 +0800 |
commit | 2ba4ddf31d27bebc144b3729479967b40bbe0b6a (patch) | |
tree | 6be2168585922040490ea0b56f982de1bf40cf6b /src/hash.cpp | |
parent | 3c776fdcec176ffaa2056633fa2b4e737cda29ce (diff) |
bloom: use Span instead of std::vector for `insert` and `contains`
We can avoid many unnecessary std::vector allocations by changing
CBloomFilter to take Spans instead of std::vector's for the `insert`
and `contains` operations.
CBloomFilter currently converts types such as CDataStream and uint256
to std::vector on `insert` and `contains`. This is unnecessary because
CDataStreams and uint256 are already std::vectors internally. We just
need a way to point to the right data within those types. Span gives
us this ability.
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat (limited to 'src/hash.cpp')
-rw-r--r-- | src/hash.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/hash.cpp b/src/hash.cpp index 3465caa3a9..92c923fbd2 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <hash.h> +#include <span.h> #include <crypto/common.h> #include <crypto/hmac_sha512.h> |