diff options
| author | Dan Engelbrecht <[email protected]> | 2023-08-21 13:09:37 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-21 13:09:37 +0200 |
| commit | 21066f050050d1e7141975e70f557de91bae1a2a (patch) | |
| tree | 54854a632e0a7b85f4217a5dafcb54f61480e335 /src/zenstore/blockstore.cpp | |
| parent | use atexit hook to shut down tracing (#369) (diff) | |
| download | zen-21066f050050d1e7141975e70f557de91bae1a2a.tar.xz zen-21066f050050d1e7141975e70f557de91bae1a2a.zip | |
use robinmap in compact cas (#368)
* Use robin-map in compactcas for 30% faster CasContainerStrategy::CollectGarbage
* use robin_set in ProjectStore::Oplog::GatherReferences and BlockStore::ReclaimSpace
* changelog
Diffstat (limited to 'src/zenstore/blockstore.cpp')
| -rw-r--r-- | src/zenstore/blockstore.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 997774ebe..d1490dce2 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -10,6 +10,11 @@ #include <algorithm> +ZEN_THIRD_PARTY_INCLUDES_START +#include <tsl/robin_map.h> +#include <tsl/robin_set.h> +ZEN_THIRD_PARTY_INCLUDES_END + #if ZEN_WITH_TESTS # include <zencore/compactbinarybuilder.h> # include <zencore/testing.h> @@ -190,7 +195,7 @@ BlockStore::Prune(const std::vector<BlockStoreLocation>& KnownLocations) RwLock::ExclusiveLockScope InsertLock(m_InsertLock); - std::unordered_set<uint32_t> KnownBlocks; + tsl::robin_set<uint32_t> KnownBlocks; for (const auto& Entry : KnownLocations) { KnownBlocks.insert(Entry.BlockIndex); @@ -391,16 +396,16 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, return; } - std::unordered_set<size_t> KeepChunkMap; + tsl::robin_set<size_t> KeepChunkMap; KeepChunkMap.reserve(KeepChunkIndexes.size()); for (size_t KeepChunkIndex : KeepChunkIndexes) { KeepChunkMap.insert(KeepChunkIndex); } - std::unordered_map<uint32_t, size_t> BlockIndexToChunkMapIndex; - std::vector<ChunkIndexArray> BlockKeepChunks; - std::vector<ChunkIndexArray> BlockDeleteChunks; + tsl::robin_map<uint32_t, size_t> BlockIndexToChunkMapIndex; + std::vector<ChunkIndexArray> BlockKeepChunks; + std::vector<ChunkIndexArray> BlockDeleteChunks; BlockIndexToChunkMapIndex.reserve(BlockCount); BlockKeepChunks.reserve(BlockCount); @@ -445,7 +450,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, DeleteCount++; } - std::unordered_set<uint32_t> BlocksToReWrite; + tsl::robin_set<uint32_t> BlocksToReWrite; BlocksToReWrite.reserve(BlockIndexToChunkMapIndex.size()); for (const auto& Entry : BlockIndexToChunkMapIndex) { |