From a032f2d84d5584a5d95e8f878cd133a5af5ab2d1 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 1 Oct 2024 12:38:49 +0200 Subject: optimize gc reference sort (#179) - Do a single call to mempcy when fetching attachments from the meta store in GC - Use small lambda when calling std::sort in FilterReferences (enables inlining of the comparision function) - Use a single function for < and == comparision in KeepUnusedReferences --- src/zenstore/cache/cachedisklayer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/zenstore/cache/cachedisklayer.cpp') diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index b67e8a570..928165185 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -3586,10 +3586,9 @@ ZenCacheDiskLayer::CacheBucket::ReadAttachmentsFromMetaData(uint32_t BlockI { if (WantedKeys.contains(*KeyIt)) { - for (uint32_t It = 0u; It < AttachmentCount; It++) - { - *OutReferencesWriteIt++ = *AttachmentReadIt++; - } + memcpy(&(*OutReferencesWriteIt), &(*AttachmentReadIt), sizeof(IoHash) * AttachmentCount); + OutReferencesWriteIt += AttachmentCount; + AttachmentReadIt += AttachmentCount; } else { -- cgit v1.2.3