Skip to content

Commit 1ac1486

Browse files
nonebackclaude
andcommitted
docs(readme): update benchmark results after observer optimization
- Update benchmark data showing 40-45% memory reduction - Add benchmark naming explanation (N{tasks}-C{concurrency}) - Add key observations section Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e393198 commit 1ac1486

1 file changed

Lines changed: 29 additions & 22 deletions

File tree

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -182,35 +182,42 @@ For more examples, visit the [examples directory](https://github.com/noneback/go
182182

183183
The following benchmarks provide a rough estimate of pure scheduling overhead using empty task functions. Note that most realistic workloads are I/O-bound, and their performance cannot be accurately reflected by these results. For CPU-intensive tasks, consider using [taskflow-cpp](https://github.com/taskflow/taskflow).
184184

185+
Benchmark naming: `N{task_count}-C{concurrency}` where concurrency is goroutine pool size.
186+
185187
```plaintext
186188
$ go test -bench=. -benchmem ./benchmark/
187189
goos: darwin
188190
goarch: arm64
189191
pkg: github.com/noneback/go-taskflow/benchmark
190-
cpu: Apple M4 Pro
191-
BenchmarkConcurrent/N8-12 217042 5349 ns/op 1781 B/op 55 allocs/op
192-
BenchmarkConcurrent/N32-12 47456 24439 ns/op 7566 B/op 213 allocs/op
193-
BenchmarkConcurrent/N128-12 10000 116586 ns/op 32209 B/op 835 allocs/op
194-
BenchmarkConcurrent/N512-12 2839 439930 ns/op 130337 B/op 3353 allocs/op
195-
BenchmarkSerial/N8-12 126259 9339 ns/op 1905 B/op 63 allocs/op
196-
BenchmarkSerial/N32-12 30313 39171 ns/op 7669 B/op 255 allocs/op
197-
BenchmarkSerial/N128-12 7758 156781 ns/op 30725 B/op 1023 allocs/op
198-
BenchmarkSerial/N512-12 1862 645739 ns/op 122952 B/op 4095 allocs/op
199-
BenchmarkDiamond-12 181072 6662 ns/op 1441 B/op 47 allocs/op
200-
BenchmarkDenseLayers/L4xW4-12 85122 13461 ns/op 4352 B/op 123 allocs/op
201-
BenchmarkDenseLayers/L4xW8-12 42927 27127 ns/op 11764 B/op 270 allocs/op
202-
BenchmarkDenseLayers/L8xW4-12 44412 27565 ns/op 8963 B/op 251 allocs/op
203-
BenchmarkDenseLayers/L8xW8-12 20775 58088 ns/op 25071 B/op 556 allocs/op
204-
BenchmarkSubflow-12 170228 6531 ns/op 1409 B/op 45 allocs/op
205-
BenchmarkCondition-12 507645 2460 ns/op 704 B/op 23 allocs/op
206-
BenchmarkConcurrencyScaling/C1-12 82400 14740 ns/op 15687 B/op 393 allocs/op
207-
BenchmarkConcurrencyScaling/C12-12 23158 52602 ns/op 15700 B/op 422 allocs/op
208-
BenchmarkConcurrencyScaling/C48-12 17500 68434 ns/op 15907 B/op 453 allocs/op
209-
BenchmarkGraphBuild/N32-12 348994 3418 ns/op 6284 B/op 230 allocs/op
210-
BenchmarkGraphBuild/N128-12 92428 13300 ns/op 24856 B/op 904 allocs/op
211-
BenchmarkGraphBuild/N512-12 22143 55325 ns/op 101709 B/op 3850 allocs/op
192+
cpu: Apple M4
193+
BenchmarkConcurrent/N8-C10-10 313968 3379 ns/op 980 B/op 45 allocs/op
194+
BenchmarkConcurrent/N32-C10-10 79144 15188 ns/op 4401 B/op 177 allocs/op
195+
BenchmarkConcurrent/N128-C10-10 19105 64433 ns/op 19331 B/op 700 allocs/op
196+
BenchmarkConcurrent/N512-C10-10 4852 244430 ns/op 79529 B/op 2803 allocs/op
197+
BenchmarkSerial/N8-C10-10 102145 11550 ns/op 1080 B/op 55 allocs/op
198+
BenchmarkSerial/N32-C10-10 24536 47829 ns/op 4346 B/op 223 allocs/op
199+
BenchmarkSerial/N128-C10-10 6342 193771 ns/op 17411 B/op 895 allocs/op
200+
BenchmarkSerial/N512-C10-10 1526 803715 ns/op 69668 B/op 3583 allocs/op
201+
BenchmarkDiamond-10 172423 6711 ns/op 816 B/op 41 allocs/op
202+
BenchmarkDenseLayers/L4xW4-C10-10 106680 11205 ns/op 2425 B/op 107 allocs/op
203+
BenchmarkDenseLayers/L4xW8-C10-10 55642 21300 ns/op 5555 B/op 210 allocs/op
204+
BenchmarkDenseLayers/L8xW4-C10-10 49852 23565 ns/op 4982 B/op 219 allocs/op
205+
BenchmarkDenseLayers/L8xW8-C10-10 26806 44465 ns/op 11640 B/op 430 allocs/op
206+
BenchmarkSubflow-10 181917 6537 ns/op 800 B/op 40 allocs/op
207+
BenchmarkCondition-10 478983 2514 ns/op 392 B/op 19 allocs/op
208+
BenchmarkConcurrencyScaling/C1-10 92156 13209 ns/op 9369 B/op 328 allocs/op
209+
BenchmarkConcurrencyScaling/C10-10 38298 30932 ns/op 9280 B/op 353 allocs/op
210+
BenchmarkConcurrencyScaling/C40-10 30091 39262 ns/op 9717 B/op 385 allocs/op
211+
BenchmarkGraphBuild/N32-10 293998 4035 ns/op 6283 B/op 230 allocs/op
212+
BenchmarkGraphBuild/N128-10 76791 15642 ns/op 24852 B/op 904 allocs/op
213+
BenchmarkGraphBuild/N512-10 17954 65742 ns/op 101692 B/op 3850 allocs/op
212214
```
213215

216+
**Key observations:**
217+
- Memory allocation reduced by ~40-45% due to lazy span creation (observer optimization)
218+
- Concurrent tasks show ~30-40% lower latency
219+
- ~6-7 allocs per task (down from ~8-9)
220+
214221
## Understanding Conditional Tasks
215222

216223
Conditional nodes in go-taskflow behave similarly to those in [taskflow-cpp](https://github.com/taskflow/taskflow). They participate in both conditional control and looping. To avoid common pitfalls, refer to the [Conditional Tasking documentation](https://taskflow.github.io/taskflow/ConditionalTasking.html).

0 commit comments

Comments
 (0)