X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fchoose-worker.js;h=7cf3029ff2aa007e22f60bc5c52fab970393ca90;hb=d1a9aa414b60e38c91f5623f3572dc46c50f5f14;hp=92eadfe4bd4bacced81ffa3af45faced420e3e88;hpb=ff5e76e152be8540cba8118bb4e2b9da314dfff5;p=poolifier.git diff --git a/benchmarks/internal/choose-worker.js b/benchmarks/internal/choose-worker.js index 92eadfe4..7cf3029f 100644 --- a/benchmarks/internal/choose-worker.js +++ b/benchmarks/internal/choose-worker.js @@ -1,15 +1,15 @@ const Benchmark = require('benchmark') +const { LIST_FORMATTER } = require('../benchmarks-utils') const suite = new Benchmark.Suite() -const LIST_FORMATTER = new Intl.ListFormat('en-US', { - style: 'long', - type: 'conjunction' -}) +function generateWorkersArray (numberOfWorkers) { + return [...Array(numberOfWorkers).keys()] +} -const workers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +const workers = generateWorkersArray(60) -let nextWorkerIndex = 0 +let nextWorkerIndex function chooseWorkerTernaryOffByOne () { nextWorkerIndex = @@ -48,7 +48,7 @@ suite nextWorkerIndex = 0 chooseWorkerTernaryWithNegation() }) - .add('Ternary with PreChoosing', function () { + .add('Ternary with pre-choosing', function () { nextWorkerIndex = 0 chooseWorkerTernaryWithPreChoosing() })