{"ScriptPreparationCode":"var bench1buffer;\r\nvar bench2buffer;\r\nvar bench3buffer;\r\n{\r\n const stride = 10;\r\n bench1buffer = new ArrayBuffer(stride * 1000);\r\n /*\r\n 0 u16 id\r\n 2 f32 x\r\n 6 f32 y\r\n */\r\n for (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const struct = new DataView(bench1buffer, i * stride, stride);\r\n struct.setUint16(0, i);\r\n struct.setFloat32(2, i);\r\n struct.setFloat32(6, i * 2);\r\n }\r\n}\r\n{\r\n const stride = 12;\r\n bench2buffer = new ArrayBuffer(stride * 1000);\r\n /*\r\n 0 u16 id\r\n 4 f32 x\r\n 8 f32 y\r\n */\r\n const floats = new Float32Array(bench2buffer);\r\n const u16s = new Uint16Array(bench2buffer);\r\n for (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n u16s[i * stride] = i;\r\n floats[i * stride \u002B 4] = i;\r\n floats[i * stride \u002B 8] = i * 2;\r\n }\r\n}\r\n{\r\n bench3buffer = {\r\n id: new Uint16Array(1000),\r\n x: new Float32Array(1000),\r\n y: new Float32Array(1000),\r\n };\r\n for (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n bench3buffer.id[i] = i;\r\n bench3buffer.x[i] = i;\r\n bench3buffer.y[i] = i * 2;\r\n }\r\n}","TestCases":[{"Name":"DataView AoS","Code":"const stride = 10;\r\n/*\r\n 0 u16 id\r\n 2 f32 x\r\n 6 f32 y\r\n*/\r\nlet sum = 0;\r\nfor (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const struct = new DataView(bench1buffer, i * stride, stride);\r\n const id = struct.getUint16(0);\r\n const x = struct.getFloat32(2);\r\n const y = struct.getFloat32(6);\r\n sum \u002B= id \u002B x * y;\r\n}","IsDeferred":false},{"Name":"DataView byte-aligned AoS","Code":"const stride = 12;\r\n/*\r\n 0 u16 id\r\n 4 f32 x\r\n 8 f32 y\r\n*/\r\nlet sum = 0;\r\nfor (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const struct = new DataView(bench2buffer, i * stride, stride);\r\n const id = struct.getUint16(0);\r\n const x = struct.getFloat32(4);\r\n const y = struct.getFloat32(8);\r\n sum \u002B= id \u002B x * y;\r\n}","IsDeferred":false},{"Name":"TypedArray AoS","Code":"const stride = 10;\r\n/*\r\n 0 u16 id\r\n 2 f32 x\r\n 6 f32 y\r\n*/\r\nlet floats = new Float32Array(bench1buffer);\r\nlet u32s = new Uint32Array(bench1buffer);\r\nlet sum = 0;\r\nfor (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const offset = i * stride;\r\n const id = floats[offset];\r\n const x = floats[offset \u002B 2];\r\n const y = floats[offset \u002B 6];\r\n sum \u002B= id \u002B x * y;\r\n}","IsDeferred":false},{"Name":"TypedArray byte-aligned AoS","Code":"const stride = 12;\r\n/*\r\n 0 u16 id\r\n 4 f32 x\r\n 8 f32 y\r\n*/\r\nlet floats = new Float32Array(bench2buffer);\r\nlet u32s = new Uint32Array(bench2buffer);\r\nlet sum = 0;\r\nfor (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const offset = i * stride;\r\n const id = floats[offset];\r\n const x = floats[offset \u002B 4];\r\n const y = floats[offset \u002B 8];\r\n sum \u002B= id \u002B x * y;\r\n}","IsDeferred":false},{"Name":"TypedArray SoA","Code":"let sum = 0;\r\nfor (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const id = bench3buffer.id[i];\r\n const x = bench3buffer.x[i];\r\n const y = bench3buffer.y[i];\r\n sum \u002B= id \u002B x * y;\r\n}","IsDeferred":false}]}