github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/gorilla/websocket/bench_test.go (about) 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 }