1// Copyright 2013-2020 Aerospike, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package aerospike
16
17// import (
18// 	"strings"
19// 	"testing"
20
21// 	"github.com/aerospike/aerospike-client-go/pkg/ripemd160"
22// 	ParticleType "github.com/aerospike/aerospike-client-go/internal/particle_type"
23// )
24
25// var str = strings.Repeat("abcd", 128)
26// var strVal = NewValue(str)
27// var buffer = []byte(str)
28// var key *Key
29
30// var res []byte
31
32// // func hash_key_baseline(str string) {
33// // 	hash := ripemd160.New()
34// // 	for i := 0; i < b.N; i++ {
35// // 		hash.Reset()
36// // 		hash.Write(buffer)
37// // 		res = hash.Sum(nil)
38// // 	}
39// // }
40
41// func Benchmark_Key_Hash_BaseLine(b *testing.B) {
42// 	hash := ripemd160.New()
43// 	for i := 0; i < b.N; i++ {
44// 		hash.Reset()
45// 		hash.Write(buffer)
46// 		res = hash.Sum(nil)
47// 	}
48// }
49
50// func Benchmark_K_Key(b *testing.B) {
51// 	for i := 0; i < b.N; i++ {
52// 		key, _ = NewKey(str, str, str)
53// 		// res = key.Digest()
54// 	}
55// }
56
57// func Benchmark_K_ComputeDigest_Raw(b *testing.B) {
58// 	h := ripemd160.New()
59// 	setName := []byte(str)
60// 	keyType := []byte{byte(ParticleType.STRING)}
61// 	keyVal := []byte(str)
62// 	for i := 0; i < b.N; i++ {
63// 		h.Reset()
64
65// 		// write will not fail; no error checking necessary
66// 		h.Write(setName)
67// 		h.Write(keyType)
68// 		h.Write(keyVal)
69
70// 		res = h.Sum(nil)
71// 	}
72// }
73