From b7a680671dbf6dd50d4b2f3c5335e34c1362fd7b Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Wed, 3 Jun 2020 02:45:34 +0200 Subject: [PATCH] Remove padding in packetcache. Since the packet entries are already overdimensioned, there's no need to add additional padding. --- packetcache/packetcache.go | 1 - packetcache/packetcache_test.go | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/packetcache/packetcache.go b/packetcache/packetcache.go index 1103db0..215c183 100644 --- a/packetcache/packetcache.go +++ b/packetcache/packetcache.go @@ -10,7 +10,6 @@ type entry struct { seqno uint16 length uint16 buf [BufSize]byte - pad [32 - (BufSize+4)%32]byte // avoid false sharing } type Cache struct { diff --git a/packetcache/packetcache_test.go b/packetcache/packetcache_test.go index 70a8ae7..fd3ffc6 100644 --- a/packetcache/packetcache_test.go +++ b/packetcache/packetcache_test.go @@ -5,7 +5,6 @@ import ( "math/rand" "sync" "testing" - "unsafe" "github.com/pion/rtcp" ) @@ -82,16 +81,6 @@ 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)