Add maskBytes benchmark.

This commit is contained in:
Gary Burd 2014-06-27 13:06:07 -07:00
parent efd7f76a14
commit d2dc86f575
1 changed files with 19 additions and 0 deletions

19
bench_test.go Normal file
View File

@ -0,0 +1,19 @@
// Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"testing"
)
func BenchmarkMaskBytes(b *testing.B) {
var key [4]byte
data := make([]byte, 1024)
pos := 0
for i := 0; i < b.N; i++ {
pos = maskBytes(key, pos, data)
}
b.SetBytes(int64(len(data)))
}