{"ScriptPreparationCode":"var N = 1000000\r\n\r\nvar x = new Float32Array(N);\r\nvar y = new Float32Array(N);\r\nvar z = new Float32Array(N);\r\n\r\nvar interlaced = new Float32Array(3*N);\r\n\r\nvar vectors = [];\r\n\r\nfor (var i = 0, li=x.length; i \u003C li; \u002B\u002Bi) {\r\n\tx[i] = Math.random();\r\n\ty[i] = Math.random();\r\n\tz[i] = Math.random();\r\n\tvectors.push( {x:Math.random(), y:Math.random(), z:Math.random()} );\r\n}\r\n\r\nfor (var i = 0, li=interlaced.length; i \u003C li; \u002B\u002Bi) {\r\n\tinterlaced[i] = Math.random();\r\n}","TestCases":[{"Name":"AoS","Code":"var vector;\r\nfor (var i = 0, li=vectors.length; i \u003C li; \u002B\u002Bi) {\r\n\tvector = vectors[i];\r\n\tvector.x = 2 * vector.x;\r\n\tvector.y = 2 * vector.y;\r\n\tvector.z = 2 * vector.z;\r\n}","IsDeferred":false},{"Name":"SoA","Code":"let x1 = x;\r\nlet y1 = y;\r\nlet z1 = z;\r\n\r\nfor (var i = 0, li=x1.length; i \u003C li; \u002B\u002Bi) {\r\n\tx1[i] = 2 * x1[i];\r\n\ty1[i] = 2 * y1[i];\r\n\tz1[i] = 2 * z1[i];\r\n}","IsDeferred":false},{"Name":"SoA - one component per loop","Code":"let x2 = x;\r\nlet y2 = y;\r\nlet z2 = z;\r\n\r\nfor (var i = 0, li=x2.length; i \u003C li; \u002B\u002Bi) {\r\n\tx2[i] = 2 * x2[i];\r\n}\r\nfor (var i = 0, li=y2.length; i \u003C li; \u002B\u002Bi) {\r\n\ty2[i] = 2 * y2[i];\r\n}\r\nfor (var i = 0, li=z2.length; i \u003C li; \u002B\u002Bi) {\r\n\tz2[i] = 2 * z2[i];\r\n}","IsDeferred":false},{"Name":"Interlaced Array - no loop unrolling","Code":"let interlaced2 = interlaced;\r\n\r\nfor (var i = 0, li=interlaced2.length; i \u003C li; \u002B\u002Bi) {\r\n\tinterlaced2[i] = 2*interlaced2[i];\r\n}","IsDeferred":false},{"Name":"Interlaced Array - with loop unrolling","Code":"let interlaced3 = interlaced;\r\n\r\nfor (var i = 0, li=interlaced3.length; i \u003C li; i\u002B=3) {\r\n\tinterlaced3[i] = 2*interlaced3[i];\r\n\tinterlaced3[i\u002B1] = 2*interlaced3[i\u002B1];\r\n\tinterlaced3[i\u002B2] = 2*interlaced3[i\u002B2];\r\n}","IsDeferred":false}]}