{"ScriptPreparationCode":"\u0027use strict\u0027;\r\nwindow.N = 1000000;\r\n\r\nclass PointAndVelocity {\r\n constructor(x, y, vx, vy) {\r\n this.x = x;\r\n this.y = y;\r\n this.vx = vx;\r\n this.vy = vy;\r\n }\r\n}\r\n\r\nclass Point {\r\n constructor(x, y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n}\r\n\r\nclass Velocity {\r\n constructor(vx, vy) {\r\n this.vx = vx;\r\n this.vy = vy;\r\n }\r\n}\r\n\r\naos = Array(N).fill(new PointAndVelocity(0, 0, 0, 0))\r\n .map(() =\u003E new PointAndVelocity(Math.random() * 100|0, Math.random() * 100|0, Math.random() * 100|0, Math.random() * 100|0));\r\n\r\n// SoA, we try to duplicate the data so numeric differences are out of the question.\r\npoints = Array(N).fill(new Point(0, 0)).\r\n .map((_, i) =\u003E new Point(aos[i].x, aos[i].y));\r\nvelocities = Array(N).fill(new Velocity(0, 0)).\r\n .map((_, i) =\u003E new Velocity(aos[i].vx, aos[i].vy));","TestCases":[{"Name":"SoA","Code":"var N = window.N;\r\nfor (var i = 0; i \u003C N; \u002B\u002Bi) {\r\n\tvar point = points[i];\r\n\tvar velocity = velocities[i];\r\n point.x \u002B= velocity.vx;\r\n point.y \u002B= velocity.vy;\r\n}","IsDeferred":false},{"Name":"AoS","Code":"var N = window.N;\r\nfor (var i = 0; i \u003C N; \u002B\u002Bi) {\r\n\tvar pav = aos[i]\r\n pav.x \u002B= pav.vx;\r\n pav.y \u002B= pav.vy;\r\n}","IsDeferred":false}]}