Avoid redundant varint decoding in chunk appender construction

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2021-10-15 20:33:14 +02:00
parent d31bb75dc4
commit ed33aea392
2 changed files with 2 additions and 2 deletions

View file

@ -154,7 +154,7 @@ func (c *HistogramChunk) Appender() (Appender, error) {
leading: it.leading,
trailing: it.trailing,
}
if binary.BigEndian.Uint16(a.b.bytes()) == 0 {
if it.numTotal == 0 {
a.leading = 0xff
}
return a, nil

View file

@ -111,7 +111,7 @@ func (c *XORChunk) Appender() (Appender, error) {
leading: it.leading,
trailing: it.trailing,
}
if binary.BigEndian.Uint16(a.b.bytes()) == 0 {
if it.numTotal == 0 {
a.leading = 0xff
}
return a, nil