Update benchmarks/versus-external-pools/dynamic-worker-nodes.js
[poolifier.git] / benchmarks / versus-external-pools / functions / function-to-bench.js
index 6a05cb629ad7bdcc816d393215bb6ae5d80a48d5..eca756b715d3a0052c99db37aafe9cc6ab1e3492 100644 (file)
@@ -1,11 +1,11 @@
 'use strict'
 /**
- * The worker function to execute during pools benchmarks.
- * NOTE: This function requires to be self-contained, thread-safe and re-entrant.
+ * The task function to execute during pools benchmarks.
+ * NOTE: This function requires to be self-contained, thread-safe and re-entrant (node-worker-threads-pool requirement).
  * @param {*} data The worker data.
  * @returns {*} The result.
  */
-module.exports = function functionToBench (data) {
+const functionToBench = (data) => {
   const crypto = require('crypto')
   const fs = require('fs')
   const TaskTypes = {
@@ -48,3 +48,5 @@ module.exports = function functionToBench (data) {
       throw new Error(`Unknown task type: ${data.taskType}`)
   }
 }
+
+module.exports = functionToBench