From b9a9689aae1d366dc0071131b7bbe6d91fb7d2aa Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 18 Sep 2024 10:35:29 +0100 Subject: [PATCH] [PERF] Chunk encoding: simplify writeByte Rather than append a zero then set the value at that position, append the value. Signed-off-by: Bryan Boreham --- tsdb/chunkenc/bstream.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tsdb/chunkenc/bstream.go b/tsdb/chunkenc/bstream.go index f9668c68c..6e01798f7 100644 --- a/tsdb/chunkenc/bstream.go +++ b/tsdb/chunkenc/bstream.go @@ -95,10 +95,8 @@ func (b *bstream) writeByte(byt byte) { // Complete the last byte with the leftmost b.count bits from byt. b.stream[i] |= byt >> (8 - b.count) - b.stream = append(b.stream, 0) - i++ // Write the remainder, if any. - b.stream[i] = byt << b.count + b.stream = append(b.stream, byt<