MCPcopy Create free account
hub / github.com/dustinxie/lockfree / BenchmarkLockfreeQueue

Function BenchmarkLockfreeQueue

queue_test.go:55–73  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

53}
54
55func BenchmarkLockfreeQueue(b *testing.B) {
56 for i := 0; i < b.N; i++ {
57 q := NewQueue()
58 wg := sync.WaitGroup{}
59 wg.Add(10)
60 for i := 0; i < 10; i++ {
61 go func(start, end int) {
62 for i := start; i < end; i++ {
63 q.Enque(i)
64 }
65 for i := start; i < end; i++ {
66 q.Deque()
67 }
68 wg.Done()
69 }(i*10000, (i+1)*10000)
70 }
71 wg.Wait()
72 }
73}
74
75func BenchmarkQueueAndRWMutex(b *testing.B) {
76 for i := 0; i < b.N; i++ {

Callers

nothing calls this directly

Calls 3

EnqueMethod · 0.95
DequeMethod · 0.95
NewQueueFunction · 0.70

Tested by

no test coverage detected