new Date().getTime() -> Date.now()
[poolifier.git] / benchmarks / internal / cluster / worker.js
index b4d54fca9976e65bbbb76da3ff5d54a4673815ff..0235afface236f2e2492e669636d74df37770c81 100644 (file)
@@ -1,14 +1,13 @@
 'use strict'
+const { isMaster } = require('cluster')
 const { ClusterWorker } = require('../../../lib/index')
+const { jsonIntegerSerialization } = require('../benchmark-utils')
+
+const debug = false
 
 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)
+  jsonIntegerSerialization(1000)
+  debug === true && console.debug('This is the main thread ' + isMaster)
   return { ok: 1 }
 }