{"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 - one loop","Code":"for (var i = 0, li=x.length; i \u003C li; \u002B\u002Bi) {\r\n\tx[i] = 2 * x[i];\r\n\ty[i] = 2 * y[i];\r\n\tz[i] = 2 * z[i];\r\n}","IsDeferred":false},{"Name":"SoA - one component per loop","Code":"for (var i = 0, li=x.length; i \u003C li; \u002B\u002Bi) {\r\n\tx[i] = 2 * x[i];\r\n}\r\nfor (var i = 0, li=y.length; i \u003C li; \u002B\u002Bi) {\r\n\ty[i] = 2 * y[i];\r\n}\r\nfor (var i = 0, li=z.length; i \u003C li; \u002B\u002Bi) {\r\n\tz[i] = 2 * z[i];\r\n}","IsDeferred":false},{"Name":"Interlaced Array - no loop unrolling","Code":"for (var i = 0, li=interlaced.length; i \u003C li; \u002B\u002Bi) {\r\n\tinterlaced[i] = 2*interlaced[i];\r\n}","IsDeferred":false},{"Name":"Interlaced Array - with loop unrolling","Code":"for (var i = 0, li=interlaced.length; i \u003C li; i\u002B=3) {\r\n\tinterlaced[i] = 2*interlaced[i];\r\n\tinterlaced[i\u002B1] = 2*interlaced[i\u002B1];\r\n\tinterlaced[i\u002B2] = 2*interlaced[i\u002B2];\r\n}","IsDeferred":false},{"Name":"AoS (bracket notation)","Code":"var vector;\r\nfor (var i = 0, li=vectors.length; i \u003C li; \u002B\u002Bi) {\r\n\tvector = vectors[i];\r\n\tvector[\u0027x\u0027] = 2 * vector[\u0027x\u0027];\r\n\tvector[\u0027y\u0027] = 2 * vector[\u0027y\u0027];\r\n\tvector[\u0027z\u0027] = 2 * vector[\u0027z\u0027];\r\n}","IsDeferred":false}]}