Test name | Executions per second |
---|---|
set f32 | 3764.5 Ops/sec |
set f64 | 1237.4 Ops/sec |
iterate and set f32 | 169.9 Ops/sec |
iterate and set f64 | 169.6 Ops/sec |
iterate and set array | 190.6 Ops/sec |
var length = 1e6;
var f32_a = Float32Array.from({length}, Math.random);
var f32_b = Float32Array.from({length}, Math.random);
var f64_a = Float64Array.from({length}, Math.random);
var f64_b = Float64Array.from({length}, Math.random);
var arr_a = Array.from({length}, Math.random);
var arr_b = Array.from({length}, Math.random);
f32_a.set(f32_b);
f64_a.set(f64_b);
for (let i = 0; i < length; i++) {
f32_a[i] = f32_b[i];
}
for (let i = 0; i < length; i++) {
f64_a[i] = f64_b[i];
}
for (let i = 0; i < length; i++) {
arr_a[i] = arr_b[i];
}