diff options
| author | Dan Engelbrecht <[email protected]> | 2024-09-30 09:27:36 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-09-30 09:27:36 +0200 |
| commit | 54ee1372c4254e185e83c8eb9329ace9704664c6 (patch) | |
| tree | a766c6bb340db9e26fe23247da7c5fce1fe39395 /src/zenstore/include | |
| parent | Fixing compilation errors with fmt v11 (#172) (diff) | |
| download | zen-54ee1372c4254e185e83c8eb9329ace9704664c6.tar.xz zen-54ee1372c4254e185e83c8eb9329ace9704664c6.zip | |
optimize startup time (#175)
* use tsl::robin_set for BlockIndexSet
don't calculate full block location when only block index is needed
* don't copy visitor function
* reserve space for attachments
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/blockstore.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/zenstore/include/zenstore/blockstore.h b/src/zenstore/include/zenstore/blockstore.h index 29c53cf22..5af9aeb10 100644 --- a/src/zenstore/include/zenstore/blockstore.h +++ b/src/zenstore/include/zenstore/blockstore.h @@ -8,6 +8,7 @@ ZEN_THIRD_PARTY_INCLUDES_START #include <tsl/robin_map.h> +#include <tsl/robin_set.h> ZEN_THIRD_PARTY_INCLUDES_END #include <unordered_set> @@ -144,18 +145,11 @@ public: void Initialize(const std::filesystem::path& BlocksBasePath, uint64_t MaxBlockSize, uint64_t MaxBlockCount); - struct BlockIndexSet - { - void Add(uint32_t BlockIndex); - std::span<const uint32_t> GetBlockIndices() const { return BlockIndexes; } - - private: - std::vector<uint32_t> BlockIndexes; - }; + typedef tsl::robin_set<uint32_t> BlockIndexSet; // Ask the store to create empty blocks for all locations that does not have a block // Remove any block that is not referenced - void SyncExistingBlocksOnDisk(const BlockIndexSet& KnownLocations); + void SyncExistingBlocksOnDisk(const BlockIndexSet& KnownBlocks); BlockEntryCountMap GetBlocksToCompact(const BlockUsageMap& BlockUsage, uint32_t BlockUsageThresholdPercent); void Close(); |