Writing binary arrays – functions vs direct access

Benchmark publishedon

Setup

const data = new Float32Array(100000);

function writeData(arr, index, ...values) {
	for (let i = 0; i < values.length; i++) {
		arr[index + i] = values[i];	
	}
}

Test Runner

Initializing...

Testing in
Test CaseOps/sec
Test with functions
writeData(data, 0, 1, 2, 3, 4, 5);
ready
Test with direct access
data[0] = 1;
data[1] = 2;
data[2] = 3;
data[3] = 4;
data[4] = 5;
ready

Revisions

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

Revision 1
publishedon