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 <tom.wilkie@gmail.com>
This commit is contained in:
Tom Wilkie 2018-11-22 07:51:57 +00:00 committed by Goutham Veeramachaneni
parent b75d702ceb
commit 88ebd749dd
2 changed files with 5 additions and 5 deletions

View file

@ -49,8 +49,8 @@ type bstream struct {
count uint8 // how many bits are valid in current byte count uint8 // how many bits are valid in current byte
} }
func newBReader(b []byte) *bstream { func newBReader(b []byte) bstream {
return &bstream{stream: b, count: 8} return bstream{stream: b, count: 8}
} }
func newBWriter(size int) *bstream { func newBWriter(size int) *bstream {

View file

@ -221,7 +221,7 @@ func (a *xorAppender) writeVDelta(v float64) {
} }
type xorIterator struct { type xorIterator struct {
br *bstream br bstream
numTotal uint16 numTotal uint16
numRead uint16 numRead uint16
@ -249,7 +249,7 @@ func (it *xorIterator) Next() bool {
} }
if it.numRead == 0 { if it.numRead == 0 {
t, err := binary.ReadVarint(it.br) t, err := binary.ReadVarint(&it.br)
if err != nil { if err != nil {
it.err = err it.err = err
return false return false
@ -266,7 +266,7 @@ func (it *xorIterator) Next() bool {
return true return true
} }
if it.numRead == 1 { if it.numRead == 1 {
tDelta, err := binary.ReadUvarint(it.br) tDelta, err := binary.ReadUvarint(&it.br)
if err != nil { if err != nil {
it.err = err it.err = err
return false return false