title: Why is this node setInterval running slow?
body: <p>The following code uses <code>setInterval</code> to increment <code>tick</code> once every 16ms and logs out the number of ticks per second. I'm expecting this to report ~60 ticks per second (as 1000ms / 16ms = ~60) but instead I'm seeing about 35-40. This is on a powerful windows desktop under minimal load (node v14.5.4). Running the same code in the browser produces the expected results.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let lastTick = 0;
  let tick = 0;
  
  setInterval(()=&gt;{
      tick++;
  }, 16);
  
  setInterval(()=&gt;{
      console.log("ticks per second: " + (tick-lastTick));
      lastTick = tick;
  }, 1000);</code></pre>
  </div>
  </div>
  </p>
  <p>What am I missing?</p>
  <p><strong>Update</strong></p>
  <p>So running with node --inspect and then profiling the javascript boosts the values up 60 per second, but only while the profiler is running. Must be some sort  of strange CPU throttling on low CPU processes, but I can't find any cause.</p>