buffer subarray operations

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
new arrays
const buf = new ArrayBuffer(1024);

for (let runs = 0; runs < 5; runs += 1) {
for (let i = 0; i < 1024; i += 64) {
	const view = new Float32Array(buf, i, 16);
	for (let j = 0; j < 16; j += 1){
		view[j] = runs;
	}
}
}
ready
with native
const buf = new ArrayBuffer(1024);
let views = []

for (let i = 0; i < 1024; i += 64) {
	views.push(new Float32Array(buf, i, 16));
}

for (let runs = 0; runs < 5; runs += 1) {
for (let i = 0; i < 16; i += 1) {
	const view = views[i];
	for (let j = 0; j < 16; j += 1){
		view[j] = runs;
	}
}
}
ready
subarrays
const buf = new Float32Array(256);

for (let runs = 0; runs < 5; runs += 1) {
for (let i = 0; i < 256; i += 16) {
	const view = buf.subarray(i, i + 16);
	for (let j = 0; j < 16; j += 1){
		view[j] = runs;
	}
}
}
ready
weirder native array
const buf = new ArrayBuffer(1024);
let views = [1]

for (let i = 0; i < 1024; i += 64) {
	views.push(new Float32Array(buf, i, 16));
}

for (let runs = 0; runs < 5; runs += 1) {
for (let i = 1; i < 17; i += 1) {
	const view = views[i];
	for (let j = 0; j < 16; j += 1){
		view[j] = runs;
	}
}
}
ready

Revisions

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