{"ScriptPreparationCode":"const world = new World();\r\nwindow.world = world;\r\n\r\nfor (let i = 1, len = 14500; i \u003C= len; i\u002B\u002B) {\r\n const player = world.add({\r\n \tscreen: {\r\n isVisible: i \u0026 1,\r\n },\r\n position: {\r\n x: i * 2,\r\n y: i * 4,\r\n },\r\n velocity: {\r\n x: i \u002B 1,\r\n y: i \u002B 2,\r\n },\r\n health: {\r\n current: i,\r\n max: i \u002B 1,\r\n }\r\n });\r\n}\r\n\r\nfor (let i = 1, len = 1500; i \u003C= len; i\u002B\u002B) {\r\n const player = world.add({\r\n position: {\r\n x: i * 2,\r\n y: i * 4,\r\n },\r\n velocity: {\r\n x: i \u002B 1,\r\n y: i \u002B 2,\r\n },\r\n });\r\n}","TestCases":[{"Name":"one big loop default","Code":"const entities = world.with(\u0022position\u0022, \u0022screen\u0022);\r\n\r\nfor (const entity of entities) {\r\n \tconst { position, screen } = entity;\r\n \tif (!screen.isVisible) {\r\n \tcontinue; \r\n }\r\n if (entity.velocity) {\r\n const { velocity } = entity;\r\n\t position.x \u002B= velocity.x\r\n \tposition.y \u002B= velocity.y\r\n }\r\n if (entity.health) {\r\n const { health } = entity;\r\n\t if (health \u003E 250) {\r\n position.x \u002B= 1;\r\n }\r\n }\r\n }","IsDeferred":false},{"Name":"one big loop no consts","Code":"const entities = world.with(\u0022position\u0022, \u0022screen\u0022);\r\n\r\nfor (const entity of entities) {\r\n if (!entity.screen.isVisible) {\r\n \tcontinue; \r\n }\r\n if (entity.position \u0026\u0026 entity.velocity) {\r\n\t entity.position.x \u002B= entity.velocity.x\r\n \tentity.position.y \u002B= entity.velocity.y\r\n }\r\n if (entity.position \u0026\u0026 entity.health) {\r\n\t if (entity.health \u003E 250) {\r\n entity.position.x \u002B= 1;\r\n }\r\n }\r\n }","IsDeferred":false},{"Name":"small loops","Code":"const velocityEntities = world.with(\u0022position\u0022, \u0022screen\u0022, \u0022velocity\u0022);\r\nconst healthEntities = world.with(\u0022position\u0022, \u0022screen\u0022, \u0022health\u0022);\r\n\r\nfor (const { position, screen, velocity } of velocityEntities) {\r\n \tif (!screen.isVisible) {\r\n \tcontinue; \r\n }\r\n position.x \u002B= velocity.x\r\n position.y \u002B= velocity.y\r\n}\r\n\r\nfor (const { position, screen, health } of healthEntities) {\r\n if (!screen.isVisible) {\r\n \tcontinue; \r\n }\r\n if (health \u003E 250) {\r\n position.x \u002B= 1;\r\n }\r\n}","IsDeferred":false},{"Name":"small loops where","Code":"const velocityEntities = world.with(\u0022position\u0022, \u0022screen\u0022, \u0022velocity\u0022).where(({ screen }) =\u003E screen.isVisible);\r\nconst healthEntities = world.with(\u0022position\u0022, \u0022screen\u0022, \u0022health\u0022).where(({ screen, health }) =\u003E screen.isVisible \u0026\u0026 health \u003E 250);\r\n\r\nfor (const { position, screen, velocity } of velocityEntities) {\r\n position.x \u002B= velocity.x\r\n position.y \u002B= velocity.y\r\n}\r\n\r\nfor (const { position, screen, health } of healthEntities) {\r\n if (health \u003E 250) {\r\n position.x \u002B= 1;\r\n }\r\n}","IsDeferred":false}]}