1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// Copyright 2019 Huan Du. All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
package clone
import "testing"
func BenchmarkSimpleClone(b *testing.B) {
orig := &testSimple{
Foo: 123,
Bar: "abcd",
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
Clone(orig)
}
}
func BenchmarkComplexClone(b *testing.B) {
m := map[string]*T{
"abc": {
Foo: 123,
Bar: map[string]interface{}{
"abc": 321,
},
},
"def": {
Foo: 456,
Bar: map[string]interface{}{
"def": 789,
},
},
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
Clone(m)
}
}
|