Filling Uint8Array forward vs backwards

Benchmark created on


Setup

const n = 10000000;
const uArr = new Uint8Array(n);

Test runner

Ready to run.

Testing in
TestOps/sec
Forward
for (let i = 0; i < n; i++) {
	uArr[i] = i;
}
ready
Backwards
let l = n;
while (l--) {
	uArr[l] = l;
}
ready

Revisions

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