Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blogrenderer/renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func BenchmarkRender(b *testing.B) {
b.Fatal(err)
}

for b.Loop() {
for i := 0; i < b.N; i++ {
postRenderer.Render(io.Discard, aPost)
}
}
2 changes: 1 addition & 1 deletion concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func BenchmarkCheckWebsites(b *testing.B) {
urls[i] = "a url"
}

for b.Loop() {
for i := 0; i < b.N; i++ {
CheckWebsites(slowStubWebsiteChecker, urls)
}
}
Expand Down
2 changes: 1 addition & 1 deletion concurrency/v1/check_websites_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func BenchmarkCheckWebsites(b *testing.B) {
urls[i] = "a url"
}

for b.Loop() {
for i := 0; i < b.N; i++ {
CheckWebsites(slowStubWebsiteChecker, urls)
}
}
2 changes: 1 addition & 1 deletion concurrency/v2/check_websites_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func BenchmarkCheckWebsites(b *testing.B) {
urls[i] = "a url"
}

for b.Loop() {
for i := 0; i < b.N; i++ {
CheckWebsites(slowStubWebsiteChecker, urls)
}
}
2 changes: 1 addition & 1 deletion concurrency/v3/check_websites_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func BenchmarkCheckWebsites(b *testing.B) {
urls[i] = "a url"
}

for b.Loop() {
for i := 0; i < b.N; i++ {
CheckWebsites(slowStubWebsiteChecker, urls)
}
}
2 changes: 1 addition & 1 deletion for/vx/repeat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestRepeat(t *testing.T) {
}

func BenchmarkRepeat(b *testing.B) {
for b.Loop() {
for i := 0; i < b.N; i++ {
Repeat("a")
}
}
4 changes: 2 additions & 2 deletions html-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ func BenchmarkRender(b *testing.B) {
}
)

for b.Loop() {
for i := 0; i < b.N; i++ {
blogrenderer.Render(io.Discard, aPost)
}
}
Expand Down Expand Up @@ -645,7 +645,7 @@ func BenchmarkRender(b *testing.B) {
b.Fatal(err)
}

for b.Loop() {
for i := 0; i < b.N; i++ {
postRenderer.Render(io.Discard, aPost)
}
}
Expand Down
4 changes: 2 additions & 2 deletions iteration.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Writing [benchmarks](https://golang.org/pkg/testing/#hdr-Benchmarks) in Go is an

```go
func BenchmarkRepeat(b *testing.B) {
for b.Loop() {
for i := 0; i < b.N; i++ {
Repeat("a")
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ Only the body of the loop is timed; it automatically excludes setup and cleanup
```go
func Benchmark(b *testing.B) {
//... setup ...
for b.Loop() {
for i := 0; i < b.N; i++ {
//... code to measure ...
}
//... cleanup ...
Expand Down