repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
---
[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 f9d125d790f97eb233194179f60b236dec3469c4..828924503c8890d597d43bdd44692fa2c3c0d16a 100644
(file)
--- a/
benchmarks/worker-selection/round-robin.mjs
+++ b/
benchmarks/worker-selection/round-robin.mjs
@@
-1,6
+1,4
@@
-import Benchmark from 'benchmark'
-
-import { LIST_FORMATTER } from '../benchmarks-utils.cjs'
+import { bench, group, run } from 'tatami-ng'
function generateWorkersArray (numberOfWorkers) {
return [...Array(numberOfWorkers).keys()]
function generateWorkersArray (numberOfWorkers) {
return [...Array(numberOfWorkers).keys()]
@@
-38,29
+36,23
@@
function roundRobinIncrementModulo () {
return chosenWorker
}
return chosenWorker
}
-new Benchmark.Suite('Round robin tasks distribution')
-
.add
('Ternary off by one', () => {
+group('Round robin tasks distribution', () => {
+
bench
('Ternary off by one', () => {
nextWorkerIndex = 0
roundRobinTernaryOffByOne()
})
nextWorkerIndex = 0
roundRobinTernaryOffByOne()
})
-
.add
('Ternary with negation', () => {
+
bench
('Ternary with negation', () => {
nextWorkerIndex = 0
roundRobinTernaryWithNegation()
})
nextWorkerIndex = 0
roundRobinTernaryWithNegation()
})
-
.add
('Ternary with pre-choosing', () => {
+
bench
('Ternary with pre-choosing', () => {
nextWorkerIndex = 0
roundRobinTernaryWithPreChoosing()
})
nextWorkerIndex = 0
roundRobinTernaryWithPreChoosing()
})
-
.add
('Increment+Modulo', () => {
+
bench
('Increment+Modulo', () => {
nextWorkerIndex = 0
roundRobinIncrementModulo()
})
nextWorkerIndex = 0
roundRobinIncrementModulo()
})
- .on('cycle', event => {
- console.info(event.target.toString())
- })
- .on('complete', function () {
- console.info(
- 'Fastest is ' + LIST_FORMATTER.format(this.filter('fastest').map('name'))
- )
- })
- .run()
+})
+
+await run({ units: true })