cluster: 'cluster'
}
-module.exports = { PoolTypes, WorkerFunctions, WorkerTypes }
+export { PoolTypes, WorkerFunctions, WorkerTypes }
-const crypto = require('crypto')
-const fs = require('fs')
-const {
+import crypto from 'crypto'
+import fs from 'fs'
+import {
DynamicClusterPool,
DynamicThreadPool,
FixedClusterPool,
FixedThreadPool
-} = require('../lib')
-const {
- PoolTypes,
- WorkerFunctions,
- WorkerTypes
-} = require('./benchmarks-types')
+} from '../lib/index.mjs'
+import { PoolTypes, WorkerFunctions, WorkerTypes } from './benchmarks-types.mjs'
async function runTest (pool, { taskExecutions, workerData }) {
return new Promise((resolve, reject) => {
}
}
-module.exports = {
+export {
WorkerFunctions,
buildPool,
executeWorkerFunction,
import Benchmark from 'benny'
import { WorkerChoiceStrategies } from '../../lib/index.mjs'
-import { PoolTypes, WorkerFunctions, WorkerTypes } from '../benchmarks-types.js'
-import { buildPool, runTest } from '../benchmarks-utils.js'
+import {
+ PoolTypes,
+ WorkerFunctions,
+ WorkerTypes
+} from '../benchmarks-types.mjs'
+import { buildPool, runTest } from '../benchmarks-utils.mjs'
const poolSize = 30
const taskExecutions = 1
import { isMaster } from 'cluster'
import { ClusterWorker } from '../../lib/index.mjs'
-import { executeWorkerFunction } from '../benchmarks-utils.js'
-import { WorkerFunctions } from '../benchmarks-types.js'
+import { executeWorkerFunction } from '../benchmarks-utils.mjs'
+import { WorkerFunctions } from '../benchmarks-types.mjs'
const debug = false
import { isMainThread } from 'worker_threads'
import { ThreadWorker } from '../../lib/index.mjs'
-import { executeWorkerFunction } from '../benchmarks-utils.js'
-import { WorkerFunctions } from '../benchmarks-types.js'
+import { executeWorkerFunction } from '../benchmarks-utils.mjs'
+import { WorkerFunctions } from '../benchmarks-types.mjs'
const debug = false
-const Benchmark = require('benny')
-const { generateRandomInteger } = require('../benchmarks-utils')
+import Benchmark from 'benny'
+import { generateRandomInteger } from '../benchmarks-utils.mjs'
function generateRandomTasksMap (
numberOfWorkers,
-const Benchmark = require('benny')
+import Benchmark from 'benny'
function generateWorkersArray (numberOfWorkers) {
return [...Array(numberOfWorkers).keys()]