repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply dependencies update
[poolifier.git]
/
benchmarks
/
internal
/
cluster
/
worker.js
diff --git
a/benchmarks/internal/cluster/worker.js
b/benchmarks/internal/cluster/worker.js
index b4d54fca9976e65bbbb76da3ff5d54a4673815ff..926278be77e4484fbbd9200af2b48fa76db27f26 100644
(file)
--- a/
benchmarks/internal/cluster/worker.js
+++ b/
benchmarks/internal/cluster/worker.js
@@
-1,14
+1,16
@@
'use strict'
'use strict'
+const { isMaster } = require('cluster')
const { ClusterWorker } = require('../../../lib/index')
const { ClusterWorker } = 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 ' + isMaster)
+ data = data || {}
+ data.function = data.function || WorkerFunctions.jsonIntegerSerialization
+ executeWorkerFunction(data)
+ debug === true && console.debug('This is the main thread ' + isMaster)
return { ok: 1 }
}
return { ok: 1 }
}