Benchmarks and performance enhancements (#209)
[poolifier.git] / benchmarks / internal / thread / worker.js
diff --git a/benchmarks/internal/thread/worker.js b/benchmarks/internal/thread/worker.js
new file mode 100644 (file)
index 0000000..2ec5f4c
--- /dev/null
@@ -0,0 +1,15 @@
+'use strict'
+const { ThreadWorker } = require('../../../lib/index')
+
+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)
+  return { ok: 1 }
+}
+
+module.exports = new ThreadWorker(yourFunction)