bench_test.go 409 B

12345678910111213141516171819
  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. package websocket
  5. import (
  6. "testing"
  7. )
  8. func BenchmarkMaskBytes(b *testing.B) {
  9. var key [4]byte
  10. data := make([]byte, 1024)
  11. pos := 0
  12. for i := 0; i < b.N; i++ {
  13. pos = maskBytes(key, pos, data)
  14. }
  15. b.SetBytes(int64(len(data)))
  16. }