Skip to content

Commit d70260d

Browse files
committed
perf: optimize sizeof CBLSLazyWrapper
It reduces memory consumption for classes CBLSLazySignature and CBLSLazyPublicKey sizeof(CBLSLazyPublicKey)=344 down to 336 sizeof(CBLSLazySignature)=536 down to 528 During full index close to ~1Bln of CBLSLazyPublicKey objects are created and destroyed as members of CDeterministicMNState and CSimplifiedMNListEntry with peak in memory close to ~1Mln It gave a bit of RAM saving (roughly 8Mb in peak) and a bit of CPU saving by being a more cache friendly. CBLSLazySignature is not used as widely as CBLSLazyPublicKey
1 parent e053c8b commit d70260d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/bls/bls.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,14 @@ class CBLSLazyWrapper
391391
mutable std::mutex mutex;
392392

393393
mutable std::array<uint8_t, BLSObject::SerSize> vecBytes;
394-
// Indicates if the value contained in vecBytes is valid
395-
mutable bool bufValid{false};
396-
mutable bool bufLegacyScheme{true};
397394

398395
mutable BLSObject obj;
399396
mutable bool objInitialized{false};
400397

398+
// Indicates if the value contained in vecBytes is valid
399+
mutable bool bufValid{false};
400+
mutable bool bufLegacyScheme{true};
401+
401402
mutable uint256 hash;
402403

403404
public:

0 commit comments

Comments
 (0)