From 88ebd749ddb70caa05cf947670fd6516e0e33fee Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Thu, 22 Nov 2018 07:51:57 +0000 Subject: [PATCH] Make newBReader return a struct, not a pointer. (#459) This shows up as a hot spot in profiles of queries involving lots of seeks, as each seek creates a new iterator. Signed-off-by: Tom Wilkie --- chunkenc/bstream.go | 4 ++-- chunkenc/xor.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chunkenc/bstream.go b/chunkenc/bstream.go index a352f078e4..ef04d44ba8 100644 --- a/chunkenc/bstream.go +++ b/chunkenc/bstream.go @@ -49,8 +49,8 @@ type bstream struct { count uint8 // how many bits are valid in current byte } -func newBReader(b []byte) *bstream { - return &bstream{stream: b, count: 8} +func newBReader(b []byte) bstream { + return bstream{stream: b, count: 8} } func newBWriter(size int) *bstream { diff --git a/chunkenc/xor.go b/chunkenc/xor.go index e5e9c9a33e..77cc3208b6 100644 --- a/chunkenc/xor.go +++ b/chunkenc/xor.go @@ -221,7 +221,7 @@ func (a *xorAppender) writeVDelta(v float64) { } type xorIterator struct { - br *bstream + br bstream numTotal uint16 numRead uint16 @@ -249,7 +249,7 @@ func (it *xorIterator) Next() bool { } if it.numRead == 0 { - t, err := binary.ReadVarint(it.br) + t, err := binary.ReadVarint(&it.br) if err != nil { it.err = err return false @@ -266,7 +266,7 @@ func (it *xorIterator) Next() bool { return true } if it.numRead == 1 { - tDelta, err := binary.ReadUvarint(it.br) + tDelta, err := binary.ReadUvarint(&it.br) if err != nil { it.err = err return false