fix: resolve import for worker-nodes
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 25 Jun 2023 22:43:17 +0000 (00:43 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 25 Jun 2023 22:43:17 +0000 (00:43 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
benchmarks/versus-external-pools/dynamic-worker-nodes.mjs
benchmarks/versus-external-pools/fixed-worker-nodes.mjs
benchmarks/versus-external-pools/hyperfine_benchmarks.sh

index a2622f9c0d5f685579c74ede404c6055233fbd9f..5404c9b8235be0c14df4deb76beccf52a4be61ab 100644 (file)
@@ -1,5 +1,4 @@
 // IMPORT LIBRARIES
-import { resolve } from 'path'
 import WorkerNodes from 'worker-nodes'
 // FINISH IMPORT LIBRARIES
 const size = parseInt(process.env.POOL_SIZE)
@@ -11,7 +10,7 @@ const data = {
 }
 
 const workerNodes = new WorkerNodes(
-  resolve('./workers/worker-nodes/function-to-bench-worker'),
+  import.meta.resolve('./workers/worker-nodes/function-to-bench-worker'),
   {
     minWorkers: size,
     maxWorkers: size * 3,
index 678851173f9bed7b6e127b8d4c7ba2e9bc7e6713..bffef10c1c171ff66c86857980845bced4016ef6 100644 (file)
@@ -1,5 +1,4 @@
 // IMPORT LIBRARIES
-import { resolve } from 'path'
 import WorkerNodes from 'worker-nodes'
 // FINISH IMPORT LIBRARIES
 const size = parseInt(process.env.POOL_SIZE)
@@ -11,7 +10,7 @@ const data = {
 }
 
 const workerNodes = new WorkerNodes(
-  resolve('./workers/worker-nodes/function-to-bench-worker'),
+  import.meta.resolve('./workers/worker-nodes/function-to-bench-worker'),
   {
     minWorkers: size,
     maxWorkers: size,
index bc7466d098268cc3d075b88b7ba4ad7453ca770d..b73ccaf404cff1ec6826706528e8ca7ac67650e8 100755 (executable)
@@ -9,8 +9,8 @@ hyperfine --export-markdown BENCH-100000.md --min-runs 20 --prepare 'sleep 2' --
   'node dynamic-tinypool.mjs' \
   'node dynamic-workerpool.mjs' \
   'node fixed-workerpool.mjs' \
-  'node dynamic-worker-nodes.mjs' \
-  'node fixed-worker-nodes.mjs' \
+  'node --experimental-import-meta-resolve dynamic-worker-nodes.mjs' \
+  'node --experimental-import-meta-resolve fixed-worker-nodes.mjs' \
   'node threadjs.mjs' \
   'node fixed-threadwork.mjs' \
   'node fixed-microjob.mjs'