Skip to content

Commit

Permalink
remove redundant cpu cache line paddings
Browse files Browse the repository at this point in the history
  • Loading branch information
alphadose committed Jul 14, 2022
1 parent efc9109 commit bfd195c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions zenq.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,16 @@ type (
_p1 [cacheLinePadSize - unsafe.Sizeof(uint64(0))]byte
readerIndex uint64
_p2 [cacheLinePadSize - unsafe.Sizeof(uint64(0))]byte
indexMask uint64
_p3 [cacheLinePadSize - unsafe.Sizeof(uint64(0))]byte
globalState uint32
_p4 [cacheLinePadSize - unsafe.Sizeof(uint32(0))]byte
indexMask uint64
// memory pool refs for storing and leasing parking spots for goroutines
alloc func() any
free func(any)
_p3 [cacheLinePadSize - unsafe.Sizeof(uint32(0)) - unsafe.Sizeof(uint64(0)) - 2*unsafe.Sizeof(func() {})]byte
SelectFactory
_p5 [cacheLinePadSize - unsafe.Sizeof(SelectFactory{})]byte
// memory pool for storing and leasing parking spots for goroutines
alloc func() any
_p6 [cacheLinePadSize - unsafe.Sizeof(func() {})]byte
free func(any)
_p7 [cacheLinePadSize - unsafe.Sizeof(func() {})]byte
_p4 [cacheLinePadSize - unsafe.Sizeof(SelectFactory{})]byte
contents []*Slot[T]
_p8 cacheLinePadding
_p5 cacheLinePadding
}
)

Expand Down

0 comments on commit bfd195c

Please sign in to comment.