clientmap_test.go 413 B

12345678910111213141516171819
  1. package turbotunnel
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. // Benchmark the ClientMap.SendQueue function. This is mainly measuring the cost
  7. // of the mutex operations around the call to clientMapInner.SendQueue.
  8. func BenchmarkSendQueue(b *testing.B) {
  9. m := NewClientMap(1 * time.Hour)
  10. id := NewClientID()
  11. m.SendQueue(id) // populate the entry for id
  12. b.ResetTimer()
  13. for i := 0; i < b.N; i++ {
  14. m.SendQueue(id)
  15. }
  16. }