typedarray vs array (v2)

Revision 2 of this benchmark created on


Setup

const init = (m) => {
	m[0] = 1; m[1] = 0; m[2] = 0; m[3] = 0;
	m[4] = 0; m[5] = 1; m[6] = 0; m[7] = 0;
	m[8] = 0; m[9] = 0; m[10] = 1; m[11] = 0;
	m[12] = 0; m[13] = 0; m[14] = 0; m[15] = 1;
	return m;
};

Test runner

Ready to run.

Testing in
TestOps/sec
typedarray
const L = [];
for (let i = 0; i < 1000; i++)
	L.push(init(new Float32Array(16)));
ready
array fill
const L = [];
for (let i = 0; i < 1000; i++)
	L.push(init(Array(16).fill(0)));

ready
array init
const L = [];
for (let i = 0; i < 1000; i++)
	L.push(init([0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]));
ready
array direct
const L = [];
for (let i = 0; i < 1000; i++)
	L.push([1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.