X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fthread-worker.mjs;h=92508dd887c80e7f6c210d87dec673c0b8952ee3;hb=61ee03c80d4de04751bf0218d9574bbd8c94e159;hp=e56eaa4cbcbb7cb0844439d3efd489278be15755;hpb=dbca3be954130834defeb4084096272ecf660c5c;p=poolifier.git diff --git a/benchmarks/internal/thread-worker.mjs b/benchmarks/internal/thread-worker.mjs index e56eaa4c..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 - -function 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 }