diff options
author | glozow <gloriajzhao@gmail.com> | 2024-06-07 14:22:14 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2024-06-07 14:32:13 +0100 |
commit | feab35189bc00bc4cf15e9dcb5cf6b34ff3a1e91 (patch) | |
tree | e6624018600a448452360178dafbc8e80949f8e4 /test/functional/test_framework | |
parent | 4a020ca443ba370bf41583962d16aa8551876f53 (diff) | |
parent | 7b8eea067f188c0b0e52ef21b01aedd37667a237 (diff) |
Merge bitcoin/bitcoin#30161: util: add VecDeque
7b8eea067f188c0b0e52ef21b01aedd37667a237 tests: add fuzz tests for VecDeque (Pieter Wuille)
62fd24af6a3fe1569662c2802f59bb68a0172087 util: add VecDeque (Pieter Wuille)
Pull request description:
Extracted from #30126.
This adds a `VecDeque` data type, inspired by `std::deque`, but backed by a single allocated memory region used as a ring buffer instead of a linked list of arrays. This gives better memory locality and less allocation overhead, plus better guarantees (some C++ standard library implementations, though not libstdc++ and libc++, use a separate allocation per element in a deque).
It is intended for the candidate set search queue in #30126, but may be useful as a replacement for `std::deque` in other places too. It's not a full drop-in replacement, as I did not add iteration support which is unnecessary for the intended use case, but nothing prevents adding that if needed.
Everything is tested through a simulation-based fuzz test that compares the behavior with normal `std::deque` equivalent operations, both for trivially-copyable/destructible types and others.
ACKs for top commit:
instagibbs:
reACK https://github.com/bitcoin/bitcoin/pull/30161/commits/7b8eea067f188c0b0e52ef21b01aedd37667a237
cbergqvist:
re-ACK 7b8eea067f188c0b0e52ef21b01aedd37667a237
hebasto:
re-ACK 7b8eea067f188c0b0e52ef21b01aedd37667a237, I've verified changes since my recent [review](https://github.com/bitcoin/bitcoin/pull/30161#pullrequestreview-2103018546) with
glozow:
ACK 7b8eea067f
Tree-SHA512: 1b62f3ba1a43a1293d8c9de047e2399442e74c46de2df81406151fe27538716ce265f35fb6779ee56d77a39cddf8fb4b4e15bda8f04ebf3b149e2f05fa55cb21
Diffstat (limited to 'test/functional/test_framework')
0 files changed, 0 insertions, 0 deletions