From 100c8f966b1c5b2fb190748f0177600562d1c5fe Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 7 Dec 2022 11:21:41 +0100 Subject: optimizations (#200) * Use direct file read and direct buffer allocation for small IoBuffer materalization * Reduce range of materialized data in CompositeBuffer reading CompressedBuffer header reading often only need a small part and not the whole file * reduce lock contention in IoBuffer::Materialize * Reduce parsing of compressed headers Validate header type at decompression * faster CreateDirectories - start from leaf going up and recurse back * optimized BufferHeader::IsValid * Add ValidateCompressedHeader to use when we don't need the actual compressed data Validate that we always get compressed data in CidStore::AddChunk * changelog --- zenserver/compute/function.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'zenserver/compute/function.cpp') diff --git a/zenserver/compute/function.cpp b/zenserver/compute/function.cpp index d7316ac64..493e2666e 100644 --- a/zenserver/compute/function.cpp +++ b/zenserver/compute/function.cpp @@ -162,7 +162,8 @@ HttpFunctionService::HttpFunctionService(CidStore& InCidStore, TotalAttachmentBytes += Buffer.GetCompressedSize(); ++AttachmentCount; - const CidStore::InsertResult InsertResult = m_CidStore.AddChunk(Buffer); + const CidStore::InsertResult InsertResult = + m_CidStore.AddChunk(Buffer.GetCompressed().Flatten().AsIoBuffer(), DataHash); if (InsertResult.New) { @@ -404,7 +405,8 @@ HttpFunctionService::HttpFunctionService(CidStore& InCidStore, TotalAttachmentBytes += CompressedSize; ++AttachmentCount; - const CidStore::InsertResult InsertResult = m_CidStore.AddChunk(DataView); + const CidStore::InsertResult InsertResult = + m_CidStore.AddChunk(DataView.GetCompressed().Flatten().AsIoBuffer(), DataHash); if (InsertResult.New) { -- cgit v1.2.3