Skip to content

Commit a0b8728

Browse files
committed
update go version
1 parent b126417 commit a0b8728

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

bench/bench_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func BenchmarkNursery(b *testing.B) {
2525
b.Run("WithRoutines/NoWork", func(b *testing.B) {
2626
for i := 0; i < b.N; i++ {
2727
conc.Block(func(n conc.Nursery) error {
28-
for j := 0; j < benchRoutineCount; j++ {
28+
for range benchRoutineCount {
2929
n.Go(func() error {
3030
return nil
3131
})
@@ -38,7 +38,7 @@ func BenchmarkNursery(b *testing.B) {
3838
b.Run("WithRoutines/Nested/NoWork", func(b *testing.B) {
3939
for i := 0; i < b.N; i++ {
4040
conc.Block(func(n conc.Nursery) error {
41-
for j := 0; j < benchRoutineCount; j++ {
41+
for range benchRoutineCount {
4242
n.Go(func() error {
4343
n.Go(func() error {
4444
return nil
@@ -54,7 +54,7 @@ func BenchmarkNursery(b *testing.B) {
5454
b.Run("WithRoutines/1msWork", func(b *testing.B) {
5555
for i := 0; i < b.N; i++ {
5656
conc.Block(func(n conc.Nursery) error {
57-
for j := 0; j < benchRoutineCount; j++ {
57+
for range benchRoutineCount {
5858
n.Go(func() error {
5959
time.Sleep(time.Millisecond)
6060
return nil
@@ -68,7 +68,7 @@ func BenchmarkNursery(b *testing.B) {
6868
b.Run("WithRoutines/1-10msWork", func(b *testing.B) {
6969
for i := 0; i < b.N; i++ {
7070
conc.Block(func(n conc.Nursery) error {
71-
for j := 0; j < benchRoutineCount; j++ {
71+
for j := range benchRoutineCount {
7272
k := j
7373
n.Go(func() error {
7474
time.Sleep(time.Duration(k%10) * time.Millisecond)
@@ -83,7 +83,7 @@ func BenchmarkNursery(b *testing.B) {
8383
b.Run("WithRoutines/Error", func(b *testing.B) {
8484
for i := 0; i < b.N; i++ {
8585
err := conc.Block(func(n conc.Nursery) error {
86-
for j := 0; j < benchRoutineCount; j++ {
86+
for range benchRoutineCount {
8787
n.Go(func() error {
8888
return io.EOF
8989
})
@@ -108,7 +108,7 @@ func BenchmarkSourceGraphConc(b *testing.B) {
108108
b.Run("WithRoutines/NoWork", func(b *testing.B) {
109109
for i := 0; i < b.N; i++ {
110110
var p pool.Pool
111-
for j := 0; j < benchRoutineCount; j++ {
111+
for range benchRoutineCount {
112112
p.Go(func() {
113113
})
114114
}
@@ -134,7 +134,7 @@ func BenchmarkSourceGraphConc(b *testing.B) {
134134
b.Run("WithRoutines/1msWork", func(b *testing.B) {
135135
for i := 0; i < b.N; i++ {
136136
var p pool.Pool
137-
for j := 0; j < benchRoutineCount; j++ {
137+
for range benchRoutineCount {
138138
p.Go(func() {
139139
time.Sleep(time.Millisecond)
140140
})
@@ -146,7 +146,7 @@ func BenchmarkSourceGraphConc(b *testing.B) {
146146
b.Run("WithRoutines/1-10msWork", func(b *testing.B) {
147147
for i := 0; i < b.N; i++ {
148148
var p pool.Pool
149-
for j := 0; j < benchRoutineCount; j++ {
149+
for j := range benchRoutineCount {
150150
k := j
151151
p.Go(func() {
152152
time.Sleep(time.Duration(k%10) * time.Millisecond)
@@ -160,7 +160,7 @@ func BenchmarkSourceGraphConc(b *testing.B) {
160160
func BenchmarkGo(b *testing.B) {
161161
b.Run("WithRoutines/NoWork", func(b *testing.B) {
162162
for i := 0; i < b.N; i++ {
163-
for j := 0; j < benchRoutineCount; j++ {
163+
for range benchRoutineCount {
164164
go func() error {
165165
return nil
166166
}()
@@ -170,7 +170,7 @@ func BenchmarkGo(b *testing.B) {
170170

171171
b.Run("WithRoutines/Nested/NoWork", func(b *testing.B) {
172172
for i := 0; i < b.N; i++ {
173-
for j := 0; j < benchRoutineCount; j++ {
173+
for range benchRoutineCount {
174174
go func() error {
175175
go func() error {
176176
return nil
@@ -183,7 +183,7 @@ func BenchmarkGo(b *testing.B) {
183183

184184
b.Run("WithRoutines/1msWork", func(b *testing.B) {
185185
for i := 0; i < b.N; i++ {
186-
for j := 0; j < benchRoutineCount; j++ {
186+
for range benchRoutineCount {
187187
go func() error {
188188
time.Sleep(time.Millisecond)
189189
return nil
@@ -194,7 +194,7 @@ func BenchmarkGo(b *testing.B) {
194194

195195
b.Run("WithRoutines/1-10msWork", func(b *testing.B) {
196196
for i := 0; i < b.N; i++ {
197-
for j := 0; j < benchRoutineCount; j++ {
197+
for j := range benchRoutineCount {
198198
go func(k int) {
199199
time.Sleep(time.Duration(k%10) * time.Millisecond)
200200
}(j)

flake.lock

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nursery.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sync/atomic"
88
)
99

10-
// Routine define a function executed in its own goroutine.
10+
// Routine define a function executed in a separate goroutine.
1111
type Routine = func() error
1212

1313
// Nursery is a supervisor that executes goroutines and manages their lifecycle.

0 commit comments

Comments
 (0)