Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This data structure provides a vector where concurrent threads can safely emplace or push back the data into. However, it does not guarantee any access or iterations happen during the insertion. It is the responsibility of the user to synchronize this behavior. This data structure is useful when the user wants to insert data into a vector concurrently in a fast manner and then iterate over the data later. If the user wants a vector implementation which reads concurrently with writer, they can use sisl::ThreadVector. This data structure is provided as a replacement for simplistic cases where insertion and iteration never happen concurrently. As a result it provides better performance than even sisl::ThreadVector and better debuggability.
Benchmark shows atleast 10x better performance on more than 4 threads concurrently inserting with mutex.
Justification for this data structure: As mentioned sisl::ThreadVector uses RCU to protect concurrent read and write. However if the caller already guarantees that with RCU it is faster and less issues to chase down (and more simpler). That is the case for Homestore writeback cache dirty buffer accumulation.