title: multiple threads vs fork process in NodeJS
body: <p>I'm trying to find a better way to run some cpu bound tasks using NodeJS. There are 2 options as I know, <strong>fork processes</strong> and <a href="https://nodejs.org/api/worker_threads.html" rel="noreferrer">worker threads</a>. So I have ran a benchmark between them and found out that fork process is faster.</p>
  
  <p>So, I have some questions here:</p>
  
  <ol>
  <li>Why is the fork process method faster? </li>
  <li>Are the worker threads useless? Or what are the worker threads advantages, consumes less cpu/memory?</li>
  </ol>
  
  <p>I'm running the code on MacOS(2.2 GHz Intel Core i7, 16 GB 1600 MHz DDR3) using node v10.15.3</p>
  
  <p>the benchmark code is in my <a href="https://gist.github.com/NeoyeElf/90c1b9568b03082fcb6caa9f547d7a1c" rel="noreferrer">gist</a>: </p>
  
  <p>threads pool library <a href="https://github.com/wilk/microjob" rel="noreferrer">microjob</a> and process pool library <a href="https://github.com/rvagg/node-worker-farm" rel="noreferrer">node-worker-farm</a> are used in my code as you can see. The running cmd is : <code>node --experimental-worker benchmark.js</code></p>