X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fthread-worker.mjs;h=92508dd887c80e7f6c210d87dec673c0b8952ee3;hb=61ee03c80d4de04751bf0218d9574bbd8c94e159;hp=f88cf076268cbff5f600a44eebc9bad7c64b0687;hpb=1c132fec1844432e7bfea1bd5d384a9880b91dbb;p=poolifier.git diff --git a/benchmarks/internal/thread-worker.mjs b/benchmarks/internal/thread-worker.mjs index f88cf076..92508dd8 100644 --- a/benchmarks/internal/thread-worker.mjs +++ b/benchmarks/internal/thread-worker.mjs @@ -1,15 +1,15 @@ -import { isMainThread } from 'worker_threads' +import { isMainThread } from 'node:worker_threads' import { ThreadWorker } from '../../lib/index.mjs' -import { executeTaskFunction } from '../benchmarks-utils.mjs' -import { TaskFunctions } from '../benchmarks-types.mjs' +import { executeTaskFunction } from '../benchmarks-utils.cjs' +import { TaskFunctions } from '../benchmarks-types.cjs' -const debug = false - -const taskFunction = (data) => { +const taskFunction = data => { data = data || {} data.function = data.function || TaskFunctions.jsonIntegerSerialization + data.debug = data.debug || false const res = executeTaskFunction(data) - debug === true && console.debug(`This is the main thread ${isMainThread}`) + data.debug === true && + console.debug(`This is the main thread ${isMainThread}`) return res }