hpx
hpx copied to clipboard
Small vector relocation
hpx::small_vector
is a small buffer optimized vector. This PR introduces two enhancements:
-
Making
small_vector
compatible with the proposed inplace_vector. This is done with creating astatic_vector
typedef forsmall_vector
that limits it to only use the direct storage mode, without introducing overhead with that limitation. -
Utilizing P1144's relocation algorithms to insert and remove elements, as well as relocate the buffer when needed. This abstracts away much of the logic needed of those operations and also optimizes them based on P1144's relocation semantics. A
small_vector
is also marked as trivially relocatable when the type it is carrying is trivially relocatable itself. That is because it is always possible that the element will be stored in the object itself.
For a small_vector<std::vector<T>>
the observable speedup of using trivial relocation for insertions, push_backs, and deletions is in the order of 2-3x, benchmarks and tests for this are to be added to this PR.