aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zenserver/cache/structuredcachestore.cpp9
-rw-r--r--zenstore/cas.cpp5
2 files changed, 7 insertions, 7 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index de5bccc3a..66f32c858 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -773,7 +773,7 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
return Entry.LastAccess < Ticks;
});
- Cids.reserve(Entries.size());
+ Cids.reserve(1024);
for (auto Kv = ValidIt; Kv != Entries.end(); ++Kv)
{
@@ -791,10 +791,13 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
if (CacheValue.Value)
{
ZEN_ASSERT(CacheValue.Value.GetContentType() == ZenContentType::kCbObject);
-
+ if (Cids.size() > 1024)
+ {
+ GcCtx.ContributeCids(Cids);
+ Cids.clear();
+ }
CbObject Obj(SharedBuffer{CacheValue.Value});
Obj.IterateAttachments([&Cids](CbFieldView Field) { Cids.push_back(Field.AsAttachment()); });
- GcCtx.ContributeCids(Cids);
}
}
}
diff --git a/zenstore/cas.cpp b/zenstore/cas.cpp
index 7b58111db..a90e45c04 100644
--- a/zenstore/cas.cpp
+++ b/zenstore/cas.cpp
@@ -39,10 +39,7 @@ CasChunkSet::AddChunkToSet(const IoHash& HashToAdd)
void
CasChunkSet::AddChunksToSet(std::span<const IoHash> HashesToAdd)
{
- for (const IoHash& Hash : HashesToAdd)
- {
- m_ChunkSet.insert(Hash);
- }
+ m_ChunkSet.insert(HashesToAdd.begin(), HashesToAdd.end());
}
void