Skip to content

Commit

Permalink
Use new for range syntax in benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
esimonov committed Mar 2, 2024
1 parent 18daecf commit 2eea56f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cache_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func Benchmark_LoadLocation(b *testing.B) {
for _, tc := range [2]string{"time", "locache"} {
for _, numLookups := range [3]int{10, 100, 1000} {
b.Run(fmt.Sprintf("%s_%d_RepeatedLookups", tc, numLookups), func(b *testing.B) {
for i := 0; i < b.N; i++ {
for range b.N {
b.StopTimer()

sut := time.LoadLocation
Expand All @@ -21,7 +21,7 @@ func Benchmark_LoadLocation(b *testing.B) {

b.StartTimer()

for j := 0; j < numLookups; j++ {
for range numLookups {
if _, err := sut("Europe/Kyiv"); err != nil {
b.Fatal(err)
}
Expand Down

0 comments on commit 2eea56f

Please sign in to comment.