]> Sergey Matveev's repositories - btrtrc.git/commit
Reorder fields to reduce padding in reader (#597)
authorYenForYang <YenForYang@users.noreply.github.com>
Mon, 13 Sep 2021 01:36:35 +0000 (20:36 -0500)
committerGitHub <noreply@github.com>
Mon, 13 Sep 2021 01:36:35 +0000 (11:36 +1000)
commit3b4d4a64ff691ec51af9442c50a1b34305b1bd3c
tree1ecd34a62d114d774ead034bb408577f73078505
parent4691b0b8d1943bdcd50088ceed8fcad9ff2a73ab
Reorder fields to reduce padding in reader (#597)

Reorder some of the fields to reduce the size of `reader`. Not much of a change -- original size was 104 bytes, with changes (moving bool's to the end) the size is 96 bytes. There's also the whole cache-friendly bit -- I tried reordering fields to help here, but I doubt it makes much of a difference.

Some other notes: `sync.Locker` is a 16 byte field. I suggest changing this to something like `*sync.RWMutex` or `*lockWithDeferreds`. This would not only reduce size but would allow access to `RLock`/`RUnlock`.
`pieceRange` could also be shrunk to 8 bytes, but I feel like I'm probably asking for too much lol.
reader.go