mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
[PERF] Chunk encoding: combine timestamp writes
Instead of a 2-bit write followed by a 14-bit write, do two 8-bit writes, which goes much faster since it avoids looping. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
b9a9689aae
commit
648a668835
|
@ -191,8 +191,8 @@ func (a *xorAppender) Append(t int64, v float64) {
|
||||||
case dod == 0:
|
case dod == 0:
|
||||||
a.b.writeBit(zero)
|
a.b.writeBit(zero)
|
||||||
case bitRange(dod, 14):
|
case bitRange(dod, 14):
|
||||||
a.b.writeBits(0b10, 2)
|
a.b.writeByte(0b10<<6 | (uint8(dod>>8) & (1<<6 - 1))) // 0b10 size code combined with 6 bits of dod.
|
||||||
a.b.writeBits(uint64(dod), 14)
|
a.b.writeByte(uint8(dod)) // Bottom 8 bits of dod.
|
||||||
case bitRange(dod, 17):
|
case bitRange(dod, 17):
|
||||||
a.b.writeBits(0b110, 3)
|
a.b.writeBits(0b110, 3)
|
||||||
a.b.writeBits(uint64(dod), 17)
|
a.b.writeBits(uint64(dod), 17)
|
||||||
|
|
Loading…
Reference in a new issue