Do TypedArrays slow down when you add attributes to them?
Date tested:
8 years ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
Test name
Executions per second
without attributes
1115.5 Ops/sec
with attributes
1115.4 Ops/sec
Benchmark definition (click to collapse):
Script Preparation code:
var array = new Float32Array(10000); var array_with_attributes = new Float32Array(10000); array_with_attributes.foo = 1;
Tests:
without attributes
for (var i = 0, li = array.length; i < li; i++) { array[i] = i; }
with attributes
for (var i = 0, li = array_with_attributes.length; i < li; i++) { array_with_attributes[i] = i; }
Open this result on MeasureThat.net