@@ -3,7 +3,9 @@ package json_diff
3
3
import (
4
4
"fmt"
5
5
"github.com/520MianXiangDuiXiang520/json-diff/decode"
6
- // "io/ioutil"
6
+ `io/ioutil`
7
+
8
+ // "io/ioutil"
7
9
"testing"
8
10
)
9
11
@@ -15,56 +17,56 @@ func TestUnmarshal(t *testing.T) {
15
17
fmt .Println (node , err )
16
18
}
17
19
18
- // func BenchmarkMarshal(b *testing.B) {
19
- // fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
20
- // // fileName := "./test_data/hash_test.json"
21
- // input, err := ioutil.ReadFile(fileName)
22
- // if err != nil {
23
- // b.Error("fail to open the ", fileName)
24
- // }
25
- // node, _ := decode.Unmarshal(input)
26
- // b.ResetTimer()
27
- // for i := 0; i < b.N; i++ {
28
- // _, _ = decode.Marshal(node)
29
- // }
30
- // }
31
- //
32
- // func BenchmarkMarshalOld(b *testing.B) {
33
- // fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
34
- // // fileName := "./test_data/hash_test.json"
35
- // input, err := ioutil.ReadFile(fileName)
36
- // if err != nil {
37
- // b.Error("fail to open the ", fileName)
38
- // }
39
- // node, _ := Unmarshal(input)
40
- // b.ResetTimer()
41
- // for i := 0; i < b.N; i++ {
42
- // _, _ = Marshal(node)
43
- // }
44
- // }
45
- //
46
- // func BenchmarkUnmarshal(b *testing.B) {
47
- // fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
48
- // // fileName := "./test_data/hash_test.json"
49
- // input, err := ioutil.ReadFile(fileName)
50
- // if err != nil {
51
- // b.Error("fail to open the ", fileName)
52
- // }
53
- // b.ResetTimer()
54
- // for i := 0; i < b.N; i++ {
55
- // _, _ = decode.Unmarshal(input)
56
- // }
57
- // }
58
- //
59
- // func BenchmarkUnmarshalOld(b *testing.B) {
60
- // fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
61
- // // fileName := "./test_data/hash_test.json"
62
- // input, err := ioutil.ReadFile(fileName)
63
- // if err != nil {
64
- // b.Error("fail to open the ", fileName)
65
- // }
66
- // b.ResetTimer()
67
- // for i := 0; i < b.N; i++ {
68
- // _, _ = Unmarshal(input)
69
- // }
70
- // }
20
+ func BenchmarkMarshal (b * testing.B ) {
21
+ fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
22
+ // fileName := "./test_data/hash_test.json"
23
+ input , err := ioutil .ReadFile (fileName )
24
+ if err != nil {
25
+ b .Error ("fail to open the " , fileName )
26
+ }
27
+ node , _ := decode .Unmarshal (input )
28
+ b .ResetTimer ()
29
+ for i := 0 ; i < b .N ; i ++ {
30
+ _ , _ = decode .Marshal (node )
31
+ }
32
+ }
33
+
34
+ func BenchmarkMarshalOld (b * testing.B ) {
35
+ fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
36
+ // fileName := "./test_data/hash_test.json"
37
+ input , err := ioutil .ReadFile (fileName )
38
+ if err != nil {
39
+ b .Error ("fail to open the " , fileName )
40
+ }
41
+ node , _ := Unmarshal (input )
42
+ b .ResetTimer ()
43
+ for i := 0 ; i < b .N ; i ++ {
44
+ _ , _ = Marshal (node )
45
+ }
46
+ }
47
+
48
+ func BenchmarkUnmarshal (b * testing.B ) {
49
+ fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
50
+ // fileName := "./test_data/hash_test.json"
51
+ input , err := ioutil .ReadFile (fileName )
52
+ if err != nil {
53
+ b .Error ("fail to open the " , fileName )
54
+ }
55
+ b .ResetTimer ()
56
+ for i := 0 ; i < b .N ; i ++ {
57
+ _ , _ = decode .Unmarshal (input )
58
+ }
59
+ }
60
+
61
+ func BenchmarkUnmarshalOld (b * testing.B ) {
62
+ fileName := "./test_data/deepcopy_test/deepcopy_speed_test.json"
63
+ // fileName := "./test_data/hash_test.json"
64
+ input , err := ioutil .ReadFile (fileName )
65
+ if err != nil {
66
+ b .Error ("fail to open the " , fileName )
67
+ }
68
+ b .ResetTimer ()
69
+ for i := 0 ; i < b .N ; i ++ {
70
+ _ , _ = Unmarshal (input )
71
+ }
72
+ }
0 commit comments