32 Star 408 Fork 63

GVPdromara/carbon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
boundary_bench_test.go 3.49 KB
一键复制 编辑 原始数据 按行查看 历史
gouguoyin 提交于 2024-01-02 23:21 . v2.3.2 提高性能测试覆盖率
package carbon
import (
"testing"
)
func BenchmarkCarbon_StartOfCentury(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfCentury()
}
for n := 0; n < b.N; n++ {
now.StartOfCentury()
}
}
func BenchmarkCarbon_EndOfCentury(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfCentury()
}
for n := 0; n < b.N; n++ {
now.EndOfCentury()
}
}
func BenchmarkCarbon_StartOfDecade(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfDecade()
}
for n := 0; n < b.N; n++ {
now.StartOfDecade()
}
}
func BenchmarkCarbon_EndOfDecade(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfDecade()
}
for n := 0; n < b.N; n++ {
now.EndOfDecade()
}
}
func BenchmarkCarbon_StartOfYear(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfYear()
}
for n := 0; n < b.N; n++ {
now.StartOfYear()
}
}
func BenchmarkCarbon_EndOfYear(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfYear()
}
for n := 0; n < b.N; n++ {
now.EndOfYear()
}
}
func BenchmarkCarbon_StartOfQuarter(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfQuarter()
}
for n := 0; n < b.N; n++ {
now.StartOfQuarter()
}
}
func BenchmarkCarbon_EndOfQuarter(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfQuarter()
}
for n := 0; n < b.N; n++ {
now.EndOfQuarter()
}
}
func BenchmarkCarbon_StartOfMonth(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfMonth()
}
for n := 0; n < b.N; n++ {
now.StartOfMonth()
}
}
func BenchmarkCarbon_EndOfMonth(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfMonth()
}
for n := 0; n < b.N; n++ {
now.EndOfMonth()
}
}
func BenchmarkCarbon_StartOfWeek(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfWeek()
}
for n := 0; n < b.N; n++ {
now.StartOfWeek()
}
}
func BenchmarkCarbon_EndOfWeek(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfWeek()
}
for n := 0; n < b.N; n++ {
now.EndOfWeek()
}
}
func BenchmarkCarbon_StartOfDay(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfDay()
}
for n := 0; n < b.N; n++ {
now.StartOfDay()
}
}
func BenchmarkCarbon_EndOfDay(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfDay()
}
for n := 0; n < b.N; n++ {
now.EndOfDay()
}
}
func BenchmarkCarbon_StartOfHour(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfHour()
}
for n := 0; n < b.N; n++ {
now.StartOfHour()
}
}
func BenchmarkCarbon_EndOfHour(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfHour()
}
for n := 0; n < b.N; n++ {
now.EndOfHour()
}
}
func BenchmarkCarbon_StartOfMinute(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfMinute()
}
for n := 0; n < b.N; n++ {
now.StartOfMinute()
}
}
func BenchmarkCarbon_EndOfMinute(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfMinute()
}
for n := 0; n < b.N; n++ {
now.EndOfMinute()
}
}
func BenchmarkCarbon_StartOfSecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().StartOfSecond()
}
for n := 0; n < b.N; n++ {
now.StartOfSecond()
}
}
func BenchmarkCarbon_EndOfSecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
NewCarbon().EndOfSecond()
}
for n := 0; n < b.N; n++ {
now.EndOfSecond()
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dromara/carbon.git
git@gitee.com:dromara/carbon.git
dromara
carbon
carbon
master

搜索帮助