Make packet cache cache-friendly.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"unsafe"
|
||||
|
||||
"github.com/pion/rtcp"
|
||||
)
|
||||
@@ -54,6 +55,16 @@ func TestCacheOverflow(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCacheAlignment(t *testing.T) {
|
||||
cache := New(16)
|
||||
for i := range cache.entries {
|
||||
p := unsafe.Pointer(&cache.entries[i])
|
||||
if uintptr(p) % 32 != 0 {
|
||||
t.Errorf("%v: alignment %v", i, uintptr(p) % 32)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBitmap(t *testing.T) {
|
||||
value := uint64(0xcdd58f1e035379c0)
|
||||
packet := make([]byte, 1)
|
||||
|
||||
Reference in New Issue
Block a user