From 3b1a66176edbee7828242648493113c070359002 Mon Sep 17 00:00:00 2001 From: Peleus <245629560@qq.com> Date: Thu, 4 Jan 2024 10:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E9=AB=98=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=A6=86=E7=9B=96=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extremum_bench_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extremum_bench_test.go b/extremum_bench_test.go index 9471774..9d432af 100755 --- a/extremum_bench_test.go +++ b/extremum_bench_test.go @@ -5,7 +5,10 @@ import "testing" func BenchmarkCarbon_Closest(b *testing.B) { now := Now() for n := 0; n < b.N; n++ { - now.Closest(Parse("2020-08-05"), Parse("2022-08-05")) + now.Closest(Yesterday(), Yesterday().AddDay()) + } + for n := 0; n < b.N; n++ { + now.Closest(Yesterday().AddDay(), Yesterday()) } for n := 0; n < b.N; n++ { now.Closest(Parse("xxx"), Parse("2022-08-05")) @@ -18,7 +21,10 @@ func BenchmarkCarbon_Closest(b *testing.B) { func BenchmarkCarbon_Farthest(b *testing.B) { now := Now() for n := 0; n < b.N; n++ { - now.Farthest(Parse("2020-08-05"), Parse("2022-08-05")) + now.Farthest(now.AddYear(), Yesterday()) + } + for n := 0; n < b.N; n++ { + now.Farthest(Yesterday(), now.AddYear()) } for n := 0; n < b.N; n++ { now.Farthest(Parse("xxx"), Parse("2022-08-05"))