| 95 | } |
| 96 | |
| 97 | func BenchmarkXor2Read(b *testing.B) { |
| 98 | c := NewXOR2Chunk() |
| 99 | app, err := c.Appender() |
| 100 | require.NoError(b, err) |
| 101 | for i := int64(0); i < 120*1000; i += 1000 { |
| 102 | app.Append(0, i, float64(i)+float64(i)/10+float64(i)/100+float64(i)/1000) |
| 103 | } |
| 104 | |
| 105 | b.ReportAllocs() |
| 106 | |
| 107 | var it Iterator |
| 108 | for b.Loop() { |
| 109 | var ts int64 |
| 110 | var v float64 |
| 111 | it = c.Iterator(it) |
| 112 | for it.Next() != ValNone { |
| 113 | ts, v = it.At() |
| 114 | } |
| 115 | _, _ = ts, v |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func requireXOR2Samples(t *testing.T, samples []triple) { |
| 120 | t.Helper() |