carbon/parser_bench_test.go

22 lines
385 B
Go
Raw Normal View History

2023-12-28 11:27:27 +08:00
package carbon
import "testing"
func BenchmarkCarbon_Parse(b *testing.B) {
for n := 0; n < b.N; n++ {
Parse("2020-08-05")
}
}
func BenchmarkCarbon_ParseByFormat(b *testing.B) {
for n := 0; n < b.N; n++ {
ParseByFormat("2020-08-05", "Y-m-d")
}
}
func BenchmarkCarbon_ParseByLayout(b *testing.B) {
for n := 0; n < b.N; n++ {
ParseByLayout("2020-08-05", "2006-01-02")
}
}