Skip to content

Commit d2dc86f

Browse files
committed
Add maskBytes benchmark.
1 parent efd7f76 commit d2dc86f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

bench_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package websocket
6+
7+
import (
8+
"testing"
9+
)
10+
11+
func BenchmarkMaskBytes(b *testing.B) {
12+
var key [4]byte
13+
data := make([]byte, 1024)
14+
pos := 0
15+
for i := 0; i < b.N; i++ {
16+
pos = maskBytes(key, pos, data)
17+
}
18+
b.SetBytes(int64(len(data)))
19+
}

0 commit comments

Comments
 (0)