repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-worker_thr...
[poolifier.git]
/
benchmarks
/
worker-selection
/
round-robin.mjs
diff --git
a/benchmarks/worker-selection/round-robin.mjs
b/benchmarks/worker-selection/round-robin.mjs
index b724a04ad5f6acc009bb86b0fd7e32318757a07b..c9366262f0e87d6908d7c4bc4045dbddd1cca15e 100644
(file)
--- a/
benchmarks/worker-selection/round-robin.mjs
+++ b/
benchmarks/worker-selection/round-robin.mjs
@@
-1,4
+1,4
@@
-import
Benchmark from 'benny
'
+import
{ bench, group, run } from 'mitata
'
function generateWorkersArray (numberOfWorkers) {
return [...Array(numberOfWorkers).keys()]
function generateWorkersArray (numberOfWorkers) {
return [...Array(numberOfWorkers).keys()]
@@
-36,24
+36,23
@@
function roundRobinIncrementModulo () {
return chosenWorker
}
return chosenWorker
}
-Benchmark.suite(
- 'Round robin tasks distribution',
- Benchmark.add('Ternary off by one', () => {
+group('Round robin tasks distribution', () => {
+ bench('Ternary off by one', () => {
nextWorkerIndex = 0
roundRobinTernaryOffByOne()
nextWorkerIndex = 0
roundRobinTernaryOffByOne()
- })
,
-
Benchmark.add
('Ternary with negation', () => {
+ })
+
bench
('Ternary with negation', () => {
nextWorkerIndex = 0
roundRobinTernaryWithNegation()
nextWorkerIndex = 0
roundRobinTernaryWithNegation()
- })
,
-
Benchmark.add
('Ternary with pre-choosing', () => {
+ })
+
bench
('Ternary with pre-choosing', () => {
nextWorkerIndex = 0
roundRobinTernaryWithPreChoosing()
nextWorkerIndex = 0
roundRobinTernaryWithPreChoosing()
- })
,
-
Benchmark.add
('Increment+Modulo', () => {
+ })
+
bench
('Increment+Modulo', () => {
nextWorkerIndex = 0
roundRobinIncrementModulo()
nextWorkerIndex = 0
roundRobinIncrementModulo()
- })
,
- Benchmark.cycle(),
- Benchmark.complete()
-)
+ })
+})
+
+
await run({ units: true }
)