File: clientmap_test.go

package info (click to toggle)
snowflake 2.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 968 kB
  • sloc: makefile: 5
file content (18 lines) | stat: -rw-r--r-- 413 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package turbotunnel

import (
	"testing"
	"time"
)

// Benchmark the ClientMap.SendQueue function. This is mainly measuring the cost
// of the mutex operations around the call to clientMapInner.SendQueue.
func BenchmarkSendQueue(b *testing.B) {
	m := NewClientMap(1 * time.Hour)
	id := NewClientID()
	m.SendQueue(id) // populate the entry for id
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		m.SendQueue(id)
	}
}