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/zencore/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/zencore/include')
| -rw-r--r-- | src/zencore/include/zencore/compactbinary.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/zencore/include/zencore/compactbinary.h b/src/zencore/include/zencore/compactbinary.h index a8707ba2b..38918d80c 100644 --- a/src/zencore/include/zencore/compactbinary.h +++ b/src/zencore/include/zencore/compactbinary.h @@ -514,7 +514,7 @@ public: ZENCORE_API std::string_view AsString(std::string_view Default = std::string_view()); ZENCORE_API std::u8string_view AsU8String(std::u8string_view Default = std::u8string_view()); - ZENCORE_API void IterateAttachments(std::function<void(CbFieldView)> Visitor) const; + ZENCORE_API void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const; /** Access the field as an int8. Returns the provided default on error. */ inline int8_t AsInt8(int8_t Default = 0) { return AsInteger<int8_t>(Default); } @@ -796,7 +796,7 @@ public: ZENCORE_API void CopyRangeTo(MutableMemoryView Buffer) const; /** Invoke the visitor for every attachment in the field range. */ - ZENCORE_API void IterateRangeAttachments(std::function<void(CbFieldView)> Visitor) const; + ZENCORE_API void IterateRangeAttachments(const std::function<void(CbFieldView)>& Visitor) const; /** Create a view of every field in the range. */ inline MemoryView GetRangeView() const { return MemoryView(FieldType::GetView().GetData(), FieldsEnd); } @@ -965,7 +965,7 @@ public: ZENCORE_API void CopyTo(BinaryWriter& Ar) const; ///** Invoke the visitor for every attachment in the array. */ - inline void IterateAttachments(std::function<void(CbFieldView)> Visitor) const + inline void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const { CreateViewIterator().IterateRangeAttachments(Visitor); } @@ -1073,7 +1073,7 @@ public: ZENCORE_API void CopyTo(BinaryWriter& Ar) const; ///** Invoke the visitor for every attachment in the object. */ - inline void IterateAttachments(std::function<void(CbFieldView)> Visitor) const + inline void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const { CreateViewIterator().IterateRangeAttachments(Visitor); } |