tinylibs / tinybench

🔎 A simple, tiny and lightweight benchmarking library!
MIT License
1.73k stars 36 forks source link

feat: concurrency mode #77

Closed Aslemammad closed 4 months ago

Aslemammad commented 5 months ago

Resolves #76

By default runConcurrently runs the different tasks concurrently at the same time! But runConcurrently(number, "task") would run the iterations of each task concurrently at the same time!

Concurrency

// options way (recommended)
bench.threshold = 10 // The maximum number of concurrent tasks to run. Defaults to Infinity.
bench.concurrency = "task" // The concurrency mode to determine how tasks are run.  
// await bench.warmup()
await bench.run()

// standalone method way
await bench.runConcurrently(10, "task") // with runConcurrently, mode is set to 'bench' by default
github-actions[bot] commented 5 months ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
dist/index.js 3.36 KB (+29.68% 🔺) 68 ms (+29.68% 🔺) 16 ms (+581.34% 🔺) 83 ms
dist/index.cjs 3.61 KB (+27.08% 🔺) 73 ms (+27.08% 🔺) 19 ms (+324.61% 🔺) 91 ms