X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fthread%2Fworker.js;h=09060ebad46032264aea8dd3f60df085cba81b8c;hb=116609a3a74b68ba940d3a0129104d4eae115ed3;hp=6437c0afe6e1f6a06a9383b9855e6b3cb0fb2a8d;hpb=bdacc2d25f190728221f7fb8c8cd2aba175cb18d;p=poolifier.git diff --git a/benchmarks/internal/thread/worker.js b/benchmarks/internal/thread/worker.js index 6437c0af..09060eba 100644 --- a/benchmarks/internal/thread/worker.js +++ b/benchmarks/internal/thread/worker.js @@ -1,10 +1,16 @@ 'use strict' +const { isMainThread } = require('worker_threads') const { ThreadWorker } = require('../../../lib/index') -const { jsonIntegerSerialization } = require('../benchmark-utils') +const { executeWorkerFunction } = require('../../benchmarks-utils') +const { WorkerFunctions } = require('../../benchmarks-types') + +const debug = false function yourFunction (data) { - jsonIntegerSerialization(1000) - // console.log('This is the main thread ' + isMainThread) + data = data || {} + data.function = data.function || WorkerFunctions.jsonIntegerSerialization + executeWorkerFunction(data) + debug === true && console.debug('This is the main thread ' + isMainThread) return { ok: 1 } }