Files
gf/internal/utils/utils_z_bench_test.go
John Guo 2cc4835c49 v2 -> v3
2025-04-10 14:12:35 +08:00

31 lines
704 B
Go

// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package utils_test
import (
"regexp"
"testing"
"github.com/gogf/gf/v3/internal/utils"
)
var (
replaceCharReg, _ = regexp.Compile(`[\-\.\_\s]+`)
)
func Benchmark_RemoveSymbols(b *testing.B) {
for i := 0; i < b.N; i++ {
utils.RemoveSymbols(`-a-b._a c1!@#$%^&*()_+:";'.,'01`)
}
}
func Benchmark_RegularReplaceChars(b *testing.B) {
for i := 0; i < b.N; i++ {
replaceCharReg.ReplaceAllString(`-a-b._a c1!@#$%^&*()_+:";'.,'01`, "")
}
}