mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-07 15:20:24 +08:00
优化代码
This commit is contained in:
@@ -53,6 +53,8 @@ func BenchmarkParseVariables(b *testing.B) {
|
||||
return "Lu"
|
||||
})
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = ParseVariables("hello, ${name}, ${age}, ${gender}, ${home}, world", func(s string) string {
|
||||
return "Lu"
|
||||
@@ -95,3 +97,11 @@ func BenchmarkParseNoVariables(b *testing.B) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParseEmpty(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = ParseVariables("", func(s string) string {
|
||||
return "Lu"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user