repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: generate documentation
[poolifier.git]
/
benchmarks
/
internal
/
thread
/
worker.js
diff --git
a/benchmarks/internal/thread/worker.js
b/benchmarks/internal/thread/worker.js
index 2ec5f4c2a54ff25550029e28e6ad491c61934bb3..09060ebad46032264aea8dd3f60df085cba81b8c 100644
(file)
--- a/
benchmarks/internal/thread/worker.js
+++ b/
benchmarks/internal/thread/worker.js
@@
-1,14
+1,16
@@
'use strict'
'use strict'
+const { isMainThread } = require('worker_threads')
const { ThreadWorker } = require('../../../lib/index')
const { ThreadWorker } = require('../../../lib/index')
+const { executeWorkerFunction } = require('../../benchmarks-utils')
+const { WorkerFunctions } = require('../../benchmarks-types')
+
+const debug = false
function yourFunction (data) {
function yourFunction (data) {
- for (let i = 0; i <= 1000; i++) {
- const o = {
- a: i
- }
- JSON.stringify(o)
- }
- // 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 }
}
return { ok: 1 }
}