title: javascript loop (for statement) slows down after 2.1 billion iteration?
body: <p>I was trying to benchmark javascript and .net core in order to choose a server side framework for  providing some specific restful services which needed to iterate large arrays(<em><strong>about 2.1 billion</strong></em>). while working on a simple code, I realized node has strange behavior after a particular number iteration. I repeated on multiple platforms and reached same result. tested platforms were:</p>
  <ul>
  <li>macOS catalina (nodeJS v.12.18) intel  core i9 4ghz 6 core</li>
  <li>linux centos 7 (nodeJS v.12.18) vm intel core i9 4ghz 2 core</li>
  <li>google chrome Version 84.0.4147.105 (Official Build) (64-bit)</li>
  <li>Mozilla firefox version 78.2</li>
  </ul>
  <p><a href="https://i.stack.imgur.com/u37E6.gif" rel="nofollow noreferrer">running video shows surprisingly increase process time about two times from 300ms to 600ms</a></p>
  <h2>sample codes:</h2>
  <h3>1. nodejs:</h3>
  <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>var cnt = 0;
  var logPeriod=100000000;
  var max=10000000000;
  for (let i = 0; i &lt; max; i++) {
    if (i % logPeriod === 0) {
      // var end = Date.now();
      if (i !== 0) {
        console.timeEnd(cnt*logPeriod, i);
        cnt++;
      }
      console.time(cnt*logPeriod);
    }
  }</code></pre>
  </div>
  </div>
  </p>
  <h3>2.browser</h3>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;script&gt;
        function doloop() {
          var cnt = 0;
          var logPeriod = 100000000;
          var max = 10000000000;
          for (let i = 0; i &lt; max; i++) {
            if (i % logPeriod === 0) {
              // var end = Date.now();
              if (i !== 0) {
                console.timeEnd(cnt * logPeriod, i);
                cnt++;
              }
              console.time(cnt * logPeriod);
            }
          }
        }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;button onclick="doloop()"&gt;doloop&lt;/button&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>