mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 22:07:27 -08:00
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:
parent
b75d702ceb
commit
88ebd749dd
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue