js-libp2p-gossipsub icon indicating copy to clipboard operation
js-libp2p-gossipsub copied to clipboard

chore: Add AsyncIterable benchmarks

Open dapplion opened this issue 3 years ago • 0 comments
trafficstars

Benchmarks to understand the cost of extra iterations in AsyncIterable flows

Benchmark output in a 4 core, model name: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz

  abortableSource cost
    ✔ async iterate abortable x0 bytesSource 10000                        240.8675 ops/s    4.151660 ms/op        -        274 runs   1.64 s
    ✔ async iterate abortable x1 bytesSource 10000                        81.45703 ops/s    12.27641 ms/op        -        140 runs   2.22 s
    ✔ async iterate abortable x2 bytesSource 10000                        56.36310 ops/s    17.74210 ms/op        -        127 runs   2.77 s
    ✔ async iterate abortable x3 bytesSource 10000                        44.51953 ops/s    22.46205 ms/op        -         16 runs  0.876 s
    ✔ async iterate abortable x4 bytesSource 10000                        27.24913 ops/s    36.69842 ms/op        -         50 runs   2.35 s

  pipe extra iterables cost
    ✔ async iterate pipe x0 transforms 10000                              382.6632 ops/s    2.613264 ms/op        -        739 runs   2.44 s
    ✔ async iterate pipe x1 transforms 10000                              228.8201 ops/s    4.370245 ms/op        -         95 runs  0.917 s
    ✔ async iterate pipe x2 transforms 10000                              147.2555 ops/s    6.790917 ms/op        -        294 runs   2.50 s
    ✔ async iterate pipe x4 transforms 10000                              87.32153 ops/s    11.45193 ms/op        -         77 runs   1.39 s
    ✔ async iterate pipe x8 transforms 10000                              47.20064 ops/s    21.18615 ms/op        -         41 runs   1.38 s

dapplion avatar Oct 14 '22 16:10 dapplion