Enhanced inplace rdf update.

This commit is contained in:
genxium
2023-02-17 18:54:51 +08:00
parent 60866674b5
commit b19549b0a8
9 changed files with 7681 additions and 225 deletions

View File

@@ -28,6 +28,19 @@ func NewRingBuffer(n int32) *RingBuffer {
}
}
func (rb *RingBuffer) DryPut() {
for 0 < rb.Cnt && rb.Cnt >= rb.N {
// Make room for the new element
rb.Pop()
}
rb.EdFrameId++
rb.Cnt++
rb.Ed++
if rb.Ed >= rb.N {
rb.Ed -= rb.N // Deliberately not using "%" operator for performance concern
}
}
func (rb *RingBuffer) Put(pItem interface{}) {
for 0 < rb.Cnt && rb.Cnt >= rb.N {
// Make room for the new element