Debian Codegraph @

unmarshal_test.go

raw symbols SCIP
1 package plist
2
3 import (
4 "reflect"
5 "testing"
6 "time"
7 )
8
9 func BenchmarkStructUnmarshal(b *testing.B) {
10 type Data struct {
11 Intarray []uint64 `plist:"intarray"`
12 Floats []float64 `plist:"floats"`
13 Booleans []bool `plist:"booleans"`
14 Strings []string `plist:"strings"`
15 Dat []byte `plist:"data"`
16 Date time.Time `plist:"date"`
17 }
18 b.ResetTimer()
19 for i := 0; i < b.N; i++ {
20 var xval Data
21 d := &Decoder{}
22 d.unmarshal(plistValueTree, reflect.ValueOf(&xval))
23 }
24 }
25
26 func BenchmarkInterfaceUnmarshal(b *testing.B) {
27 for i := 0; i < b.N; i++ {
28 var xval interface{}
29 d := &Decoder{}
30 d.unmarshal(plistValueTree, reflect.ValueOf(&xval))
31 }
32 }
33
34 func BenchmarkLargeArrayUnmarshal(b *testing.B) {
35 var xval [1024]byte
36 pval := cfData(make([]byte, 1024))
37 b.ResetTimer()
38 for i := 0; i < b.N; i++ {
39 d := &Decoder{}
40 d.unmarshal(pval, reflect.ValueOf(&xval))
41 }
42 }