diff options
| author | Dan Engelbrecht <[email protected]> | 2024-09-17 15:05:40 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-09-17 15:05:40 +0200 |
| commit | d020b6522b2d962db67f8a66410e74d61cf3da24 (patch) | |
| tree | 44985edb66e5405df2d3a57c291490b2a0485337 /src/zencore/compactbinaryvalidation.cpp | |
| parent | Running the public github release mirroring as part of creating the release (... (diff) | |
| download | zen-d020b6522b2d962db67f8a66410e74d61cf3da24.tar.xz zen-d020b6522b2d962db67f8a66410e74d61cf3da24.zip | |
gc performance improvements (#160)
* optimized ValidateCbUInt
* optimized iohash comparision
* replace unordered set/map with tsl/robin set/map in blockstore
* increase max buffer size when writing cache bucket sidecar
* only store meta data for files < 4Gb
* faster ReadAttachmentsFromMetaData
* remove memcpy call in BlockStoreDiskLocation
* only write cache bucket state to disk if GC deleted anything
Diffstat (limited to 'src/zencore/compactbinaryvalidation.cpp')
| -rw-r--r-- | src/zencore/compactbinaryvalidation.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/zencore/compactbinaryvalidation.cpp b/src/zencore/compactbinaryvalidation.cpp index db830d250..82738e678 100644 --- a/src/zencore/compactbinaryvalidation.cpp +++ b/src/zencore/compactbinaryvalidation.cpp @@ -86,23 +86,24 @@ ValidateCbFieldType(MemoryView& View, CbValidateMode Mode, CbValidateError& Erro static uint64_t ValidateCbUInt(MemoryView& View, CbValidateMode Mode, CbValidateError& Error) { - if (View.GetSize() > 0 && View.GetSize() >= MeasureVarUInt(View.GetData())) + size_t ViewSize = View.GetSize(); + if (ViewSize > 0) { - uint32_t ValueByteCount; - const uint64_t Value = ReadVarUInt(View.GetData(), ValueByteCount); - if (EnumHasAnyFlags(Mode, CbValidateMode::Format) && ValueByteCount > MeasureVarUInt(Value)) + uint32_t ValueByteCount = MeasureVarUInt(View.GetData()); + if (ViewSize >= ValueByteCount) { - AddError(Error, CbValidateError::InvalidInteger); + const uint64_t Value = ReadMeasuredVarUInt(View.GetData(), ValueByteCount); + if (EnumHasAnyFlags(Mode, CbValidateMode::Format) && ValueByteCount != MeasureVarUInt(Value)) + { + AddError(Error, CbValidateError::InvalidInteger); + } + View += ValueByteCount; + return Value; } - View += ValueByteCount; - return Value; - } - else - { - AddError(Error, CbValidateError::OutOfBounds); - View.Reset(); - return 0; } + AddError(Error, CbValidateError::OutOfBounds); + View.Reset(); + return 0; } /** |