优化代码

This commit is contained in:
GoEdgeLab
2022-04-04 16:42:56 +08:00
parent 9115d34472
commit 0da37a7843
2 changed files with 21 additions and 4 deletions

View File

@@ -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"
})
}
}