mirror of
https://github.com/prometheus/prometheus.git
synced 2026-03-10 16:11:03 +01:00
bench(chunkenc): add t=gap-jitter tPattern to demonstrate XOR18111 efficiency
The pattern uses a 60s base interval with a single 10-interval gap at sample 10, followed by 60s ± 30ms jitter. This demonstrates two advantages of XOR18111 over standard XOR: - The gap (dod=540000ms = 9×60000) triggers full mode via multiplier encoding (22 bits vs ~68 bits in standard XOR). - Post-gap delta-of-deltas (≤30ms) use the 7-bit full-mode code (9 bits total) vs XOR compact's minimum 14-bit code (16 bits total), saving 7 bits per sample across the remaining 108 samples. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
61679a0977
commit
163f4bf322
@ -89,6 +89,23 @@ func foreachFmtSampleCase(b *testing.B, fn func(b *testing.B, f fmtCase, s sampl
|
||||
name: "t=jitter",
|
||||
next: func(t int64, i int) int64 { return t + rInts[i] - 50 + 15000 },
|
||||
},
|
||||
{
|
||||
// First 10 samples at constant 60s, then one 10-interval gap (600s),
|
||||
// then 60s ± 30ms jitter. The gap triggers XOR18111 full mode via
|
||||
// multiplier encoding (dod=540000 = 9×60000). Subsequent small-jitter
|
||||
// delta-of-deltas (≤30ms) use XOR18111's 7-bit full-mode code (9 bits
|
||||
// total) vs XOR compact's minimum 14-bit code (16 bits total).
|
||||
name: "t=gap-jitter",
|
||||
next: func(t int64, i int) int64 {
|
||||
if i < 10 {
|
||||
return t + 60000
|
||||
}
|
||||
if i == 10 {
|
||||
return t + 10*60000 // 10-interval gap; triggers XOR18111 full mode.
|
||||
}
|
||||
return t + 60000 + rInts[i]%61 - 30 // 60s ± 30ms jitter.
|
||||
},
|
||||
},
|
||||
}
|
||||
vPatterns := []vPattern{
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user