From d2dc86f575bda0aa59451d65ba6ff1ef39dd8cc8 Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Fri, 27 Jun 2014 13:06:07 -0700 Subject: [PATCH] Add maskBytes benchmark. --- bench_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bench_test.go diff --git a/bench_test.go b/bench_test.go new file mode 100644 index 0000000..f66fc36 --- /dev/null +++ b/bench_test.go @@ -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))) +}