-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_bench_test.go
131 lines (106 loc) · 2.62 KB
/
t_bench_test.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package gt_test
import (
"path"
"testing"
"github.com/mitranim/gt"
)
func Benchmark_ParseNullUuid_simple(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
_ = gt.ParseNullUuid(`a915f35f0a3344bc8b9fb36bb650708d`)
}
}
func Benchmark_ParseNullUuid_canon(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
_ = gt.ParseNullUuid(`c230ed9a-e855-469c-8ebb-59c565aacaa7`)
}
}
func Benchmark_NullUuid_string(b *testing.B) {
val := gt.ParseNullUuid(`6b4c96c70bbc4d57a673de9620688f01`)
b.ResetTimer()
for ind := 0; ind < b.N; ind++ {
_ = val.String()
}
}
func Benchmark_Uuid_GoString(b *testing.B) {
val := gt.ParseUuid(`6b4c96c70bbc4d57a673de9620688f01`)
b.ResetTimer()
for ind := 0; ind < b.N; ind++ {
_ = val.GoString()
}
}
func Benchmark_NullUuid_GoString(b *testing.B) {
val := gt.ParseNullUuid(`6b4c96c70bbc4d57a673de9620688f01`)
b.ResetTimer()
for ind := 0; ind < b.N; ind++ {
_ = val.GoString()
}
}
func Benchmark_RandomUuid(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
_ = gt.RandomUuid()
}
}
func Benchmark_RandomUuid_String(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
_ = gt.RandomUuid().String()
}
}
func Benchmark_ParseNullDate(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
_ = gt.ParseNullDate(`1234-05-06`)
}
}
func Benchmark_NullDate_String(b *testing.B) {
val := gt.ParseNullDate(`1234-05-06`)
b.ResetTimer()
for ind := 0; ind < b.N; ind++ {
_ = val.String()
}
}
func Benchmark_ParseNullInterval(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
_ = gt.ParseNullInterval(`P12Y23M34DT45H56M67S`)
}
}
func Benchmark_NullInterval_String(b *testing.B) {
val := gt.ParseNullInterval(`P12Y23M34DT45H56M67S`)
b.ResetTimer()
for ind := 0; ind < b.N; ind++ {
_ = val.String()
}
}
func Benchmark_path_Join_one(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
path.Join(`one`)
}
}
func Benchmark_gt_Join_one(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
gt.Join(`one`)
}
}
func Benchmark_path_Join_many(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
path.Join(`one`, `two`, `three`)
}
}
func Benchmark_gt_Join_many(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
gt.Join(`one`, `two`, `three`)
}
}
func Benchmark_ParseNullUrl(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
gt.ParseNullUrl(`https://user:[email protected]/four/five/six?one=two&one=three&four=five&five=six&seven=eight&nine=ten&nine=eleven#hash`)
}
}
func Benchmark_ParseNullTimeMilli(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
gt.ParseNullTime(`1234567890123`)
}
}
func Benchmark_ParseNullTimeNormal(b *testing.B) {
for ind := 0; ind < b.N; ind++ {
gt.ParseNullTime(`1234-05-06T07:08:09Z`)
}
}