MCPcopy
hub / github.com/gorilla/websocket / BenchmarkWriteWithCompression

Function BenchmarkWriteWithCompression

compression_test.go:55–66  ·  compression_test.go::BenchmarkWriteWithCompression
(b *testing.B)

Source from the content-addressed store, hash-verified

53}
54
55func BenchmarkWriteWithCompression(b *testing.B) {
56 w := ioutil.Discard
57 c := newTestConn(nil, w, false)
58 messages := textMessages(100)
59 c.enableWriteCompression = true
60 c.newCompressionWriter = compressNoContextTakeover
61 b.ResetTimer()
62 for i := 0; i < b.N; i++ {
63 c.WriteMessage(TextMessage, messages[i%len(messages)])
64 }
65 b.ReportAllocs()
66}
67
68func TestValidCompressionLevel(t *testing.T) {
69 c := newTestConn(nil, nil, false)

Callers

nothing calls this directly

Calls 3

newTestConnFunction · 0.85
textMessagesFunction · 0.85
WriteMessageMethod · 0.80

Tested by

no test coverage detected