X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fversus-external-pools%2Ffunctions%2Ffunction-to-bench.js;h=eca756b715d3a0052c99db37aafe9cc6ab1e3492;hb=b9da9d7e74c720f83482a09d1b883fc83d04f4ed;hp=74a07d1ef1ac4f410e8fada4679f1ed64d3bcac1;hpb=bea2d6e33a81c97cfb0cc003befd149eddcd4708;p=poolifier.git diff --git a/benchmarks/versus-external-pools/functions/function-to-bench.js b/benchmarks/versus-external-pools/functions/function-to-bench.js index 74a07d1e..eca756b7 100644 --- a/benchmarks/versus-external-pools/functions/function-to-bench.js +++ b/benchmarks/versus-external-pools/functions/function-to-bench.js @@ -1,10 +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 = { @@ -47,3 +48,5 @@ module.exports = function functionToBench (data) { throw new Error(`Unknown task type: ${data.taskType}`) } } + +module.exports = functionToBench