let memory = new WebAssembly.Memory({ initial: 10 });
let view = new Uint32Array(memory.buffer);
function set(index, value) {
if (view.buffer !== memory.buffer) {
view = new Uint32Array(memory.buffer);
}
view[index] = value;
}
for (let i = 0; i < 65000; ++i) {
if ((i % 10000) == 0) memory.grow(1);
set(i, i);
set(i + 1, i);
set(i + 2, i);
}
for (let i = 0; i < 65000; ++i) {
if ((i % 10000) == 0) memory.grow(1);
new Uint32Array(memory.buffer)[i] = i;
new Uint32Array(memory.buffer)[i + 1] = i;
new Uint32Array(memory.buffer)[i + 2] = i;
}
let view = new DataView(memory.buffer);
function set(index, value) {
if (view.buffer !== memory.buffer) {
view = new DataView(memory.buffer);
}
view.setUint32(index << 2, value);
}
for (let i = 0; i < 65000; ++i) {
if ((i % 10000) == 0) memory.grow(1);
set(i, i);
set(i + 1, i);
set(i + 2, i);
}
let view = new DataView(memory.buffer);
function set(index, value) {
try {
view.setUint32(index << 2, value);
} catch (e) {
view = new DataView(memory.buffer);
view.setUint32(index << 2, value);
}
}
for (let i = 0; i < 65000; ++i) {
if ((i % 10000) == 0) memory.grow(1);
set(i, i);
set(i + 1, i);
set(i + 2, i);
}
let view = new DataView(memory.buffer);
function set(index, value) {
try {
view.setUint32(index << 2, value);
} catch (e) {
view = new DataView(memory.buffer);
view.setUint32(index << 2, value);
}
}
for (let i = 0; i < 65000; ++i) {
if ((i % 10000) == 0) memory.grow(1);
set(i, i);
view.setUint32((i + 1) << 2, i);
view.setUint32((i + 2) << 2, i);
}
let view = new DataView(memory.buffer);
for (let i = 0; i < 65000; ++i) {
if ((i % 10000) == 0) memory.grow(1);
try {
view.setUint32(i << 2, i);
} catch {
view = new DataView(memory.buffer);
view.setUint32(i << 2, i);
}
view.setUint32((i + 1) << 2, i);
view.setUint32((i + 2) << 2, i);
}