title: Javascript TypedArray performance
body: <p>Why are TypedArrays not faster than usual arrays? I want to use precalculate values for CLZ (compute leading zeros function). And I don't want they interpreting as usual objects?</p>
  <p><a href="http://jsperf.com/array-access-speed-2/2" rel="nofollow noreferrer">http://jsperf.com/array-access-speed-2/2</a></p>
  <p>Preparation code:</p>
  <pre><code> Benchmark.prototype.setup = function() {
     var buffer = new ArrayBuffer(0x10000);
     var Uint32 = new Uint32Array(buffer);
     var arr = [];
     for(var i = 0; i &lt; 0x10000; ++i) {
       Uint32[i] = (Math.random() * 0x100000000) | 0;
       arr[i] = Uint32[i];
     }
     var sum = 0;
   };
  </code></pre>
  <p>Test 1:</p>
  <pre><code>sum = arr[(Math.random() * 0x10000) | 0];
  </code></pre>
  <p>Test 2:</p>
  <pre><code>sum = Uint32[(Math.random() * 0x10000) | 0];
  </code></pre>
  <p><img src="https://i.stack.imgur.com/Va7K8.png" alt="enter image description here" /></p>
  <p>PS: May be my perf tests are invalid feel free to correct me.</p>