@@ -7,31 +7,31 @@ import (
77 mh "github.com/multiformats/go-multihash"
88)
99
10- type myStruct struct {
11- items map [string ]myStruct
12- foo string
13- bar []byte
14- baz []int
10+ type MyStruct struct {
11+ Items map [string ]MyStruct
12+ Foo string
13+ Bar []byte
14+ Baz []int
1515}
1616
1717func init () {
18- RegisterCborType (myStruct {})
18+ RegisterCborType (MyStruct {})
1919}
2020
21- func testStruct () myStruct {
22- return myStruct {
23- items : map [string ]myStruct {
24- "foo " : {
25- foo : "foo " ,
26- bar : []byte ("bar " ),
27- baz : []int {1 , 2 , 3 , 4 },
21+ func testStruct () MyStruct {
22+ return MyStruct {
23+ Items : map [string ]MyStruct {
24+ "Foo " : {
25+ Foo : "Foo " ,
26+ Bar : []byte ("Bar " ),
27+ Baz : []int {1 , 2 , 3 , 4 },
2828 },
29- "bar " : {
30- bar : []byte ("bar " ),
31- baz : []int {1 , 2 , 3 , 4 },
29+ "Bar " : {
30+ Bar : []byte ("Bar " ),
31+ Baz : []int {1 , 2 , 3 , 4 },
3232 },
3333 },
34- baz : []int {5 , 1 , 2 },
34+ Baz : []int {5 , 1 , 2 },
3535 }
3636}
3737
@@ -102,3 +102,13 @@ func BenchmarkDecodeBlockParallel(b *testing.B) {
102102 }
103103 wg .Wait ()
104104}
105+
106+ func BenchmarkDumpObject (b * testing.B ) {
107+ obj := testStruct ()
108+ for i := 0 ; i < b .N ; i ++ {
109+ bytes , err := DumpObject (obj )
110+ if err != nil {
111+ b .Fatal (err , bytes )
112+ }
113+ }
114+ }
0 commit comments