tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

shrink-large-array.js (268B)


      1 // Shrink a large dense elements allocation of ~2MB to half its size.
      2 const sizeMB = 2;
      3 const elementCount = (sizeMB * 1024 * 1024) / 8;
      4 const array = new Array(elementCount);
      5 for (let i = 0; i < elementCount; i++) {
      6  array[i] = i;
      7 }
      8 array.length = elementCount / 2;