Uint8 vs DataView

Benchmark created on


Setup

const len = 10;
const arr = [...Array(len).keys()];

const b = new ArrayBuffer(len);



Test runner

Ready to run.

Testing in
TestOps/sec
Uint8Array
const u8arr = new Uint8Array(b);

for (let i = 0; i < arr.length; i++) {
	u8arr[i] = i;
}
ready
DataView
const dv = new DataView(b);

for (let i = 0; i < arr.length; i++) {
	dv.setUint8(i, i);
}
ready

Revisions

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