Open arturmelanchyk opened 6 months ago
@arturmelanchyk , please sign commits with GPG
Just a kind reminder @tomekkolo @SimoneLazzaris , branch has been rebased onto latest master and all commits signed with GPG
Just a kind reminder @tomekkolo @SimoneLazzaris , branch has been rebased onto latest master and all commits signed with GPG
Looked at it once more, why using 64 bit ? If you follow the path where it is used (DatabaseHealth), it is anyway cut to 32bits at the end. And generally, no need for such big counter here. Also not sure about real gain, this endpoint is not called so much.
@tomekkolo
instrumentedRWMutex
type, its used everywhere instead of regular sync.Mutex
and sync.RWMutex
https://github.com/codenotary/immudb/blob/c7265c67d1a9d52940822332da82e0d543a86547/pkg/database/database.go#L147-L153see list of methods that use it:
as a result, even tiny improvement in this type will lead to noticeable speed boost
int
which would anyway compile to 64 bits on most of the modern computers, so technically we do not add anything. Moreover, due to how golang aling structs in memory in this specific case it will anyway use 64bit, not 32, even if you change the type to 32bit
This change minimizes lock contention when working with
instrumentedRWMutex
According to the attached benchmarkLock
\Unlock
operations as well asRLock
\RUnlock
gain ~50% performance boost whileState
's performance remains on the same level