General warning: Go's benchmark utility (go test -bench .) increases the number of iterations until the benchmarks take a reasonable amount of time to run; memory usage is *NOT* considered. On my machine, these benchmarks hit around ~1GB before they've had enough, but if you have less than that avai
(b *testing.B)
| 147 | // enough, but if you have less than that available and start swapping, then all bets are off. |
| 148 | |
| 149 | func BenchmarkQueueSerial(b *testing.B) { |
| 150 | q := New() |
| 151 | for i := 0; i < b.N; i++ { |
| 152 | q.Add(nil) |
| 153 | } |
| 154 | for i := 0; i < b.N; i++ { |
| 155 | q.Peek() |
| 156 | q.Remove() |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | func BenchmarkQueueGet(b *testing.B) { |
| 161 | q := New() |