title: javascript - proper way to do thousands of $.getJSON calls to avoid ERR_INSUFFICIENT_RESOURCE
body: <p><strong>Problems</strong>:</p>
  <p>I'm doing some data lookup from a website contain thousands of <code>.json</code> files, now I'm reading those .json with a straight forward for loop <code>$.getJSON</code> calls. It works fine within ~3000 files, but when the size goes up to 5000 or even 20000 (max number I've to read). The Chrome browser becomes super slow or get <code>ERR_INSUFFICIENT_RESOURCE</code>.</p>
  <p><strong>What I'm doing right now:</strong></p>
  <ol>
  <li>scan through data <code>example.org/1.json</code> to <code>20000.json</code></li>
  <li>read these <code>.json</code> content into <code>arrayone[]</code>, process array of data captured</li>
  <li>based on <code>arrayone[]</code>, I do another <code>$.getJSON</code> on <code>example.org/someplace/1.json</code> to <code>20000.json</code></li>
  <li>read these <code>.json</code> content into <code>arraytwo[]</code></li>
  <li>compare <code>arrayone[]</code> &amp; <code>arraytwo[]</code></li>
  </ol>
  <p>So given I've to read 20000 files, it's actually 40000 <code>$.getJSON</code> call.</p>
  <p><strong>Seek helps:</strong></p>
  <p>Is there a smarter way to read multiple <code>.json</code> with better performance?
  Hope it's clear, thanks in advance!</p>