forked from smarty-prototypes/go-disruptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cursor_test.go
52 lines (38 loc) · 824 Bytes
/
cursor_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package disruptor
import "testing"
func BenchmarkCursorStore(b *testing.B) {
iterations := int64(b.N)
cursor := NewCursor()
b.ReportAllocs()
b.ResetTimer()
for i := int64(0); i < iterations; i++ {
cursor.Store(i)
}
}
func BenchmarkCursorLoad(b *testing.B) {
iterations := int64(b.N)
cursor := NewCursor()
b.ReportAllocs()
b.ResetTimer()
for i := int64(0); i < iterations; i++ {
cursor.Load()
}
}
func BenchmarkCursorRead(b *testing.B) {
iterations := int64(b.N)
cursor := NewCursor()
b.ReportAllocs()
b.ResetTimer()
for i := int64(0); i < iterations; i++ {
cursor.Read(i)
}
}
func BenchmarkCursorReadAsBarrier(b *testing.B) {
var barrier Barrier = NewCursor()
iterations := int64(b.N)
b.ReportAllocs()
b.ResetTimer()
for i := int64(0); i < iterations; i++ {
barrier.Read(0)
}
}