{"action":"opened","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4320","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4320/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4320/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4320/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4320","id":87687329,"number":4320,"title":"undued closure allocation (3.1.3) on target flash  / check request","user":{"login":"delahee","id":644444,"avatar_url":"https://avatars.githubusercontent.com/u/644444?v=3","gravatar_id":"","url":"https://api.github.com/users/delahee","html_url":"https://github.com/delahee","followers_url":"https://api.github.com/users/delahee/followers","following_url":"https://api.github.com/users/delahee/following{/other_user}","gists_url":"https://api.github.com/users/delahee/gists{/gist_id}","starred_url":"https://api.github.com/users/delahee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delahee/subscriptions","organizations_url":"https://api.github.com/users/delahee/orgs","repos_url":"https://api.github.com/users/delahee/repos","events_url":"https://api.github.com/users/delahee/events{/privacy}","received_events_url":"https://api.github.com/users/delahee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-12T10:42:54Z","updated_at":"2015-06-12T10:42:54Z","closed_at":null,"body":"As discussed on irc with Simn.\r\n\r\nI tracked down our major source of allocation in some context to this:\r\n\r\n```\r\noverride function drawRec( ctx : h2d.RenderContext ) {\r\n\t\tif ( style.visibility == false ) return;\r\n\t\tif ( style.overflowHidden!=null&&style.overflowHidden ) {\r\n\t\t\tbgFill.afterDraw = function() {\r\n\t\t\tvar px = (absX + 1) / matA;\r\n\t\t\tvar py = (absY - 1) / matD;\r\n\t\t\t\r\n\t\t\tvar rX = px;\r\n\t\t\tvar rY = py;\r\n\t\t\tvar rW = contentWidth;\r\n\t\t\tvar rH = contentHeight;\r\n\r\n\t\t\t\r\n\t\t\told = ctx.engine.getRenderZone();\r\n\t\t\tif ( old != null ){\r\n\t\t\t\told = old.clone();\r\n\r\n\t\t\t\trW = Math.min( rX+rW, old.x+old.z );\r\n\t\t\t\trH = Math.min( rY+rH, old.y+old.w );\r\n\t\t\t\trX = Math.max( rX, old.x );\r\n\t\t\t\trY = Math.max( rY, old.y );\r\n\r\n\t\t\t\trW -= rX;\r\n\t\t\t\trH -= rY;\r\n\t\t\t}\r\n\t\t\tctx.flush();\r\n\t\t\tctx.engine.setRenderZone( Std.int(rX), Std.int(rY), Std.int(rW), Std.int(rH) );\r\n\t\t};\r\n\t\t}\r\n\t\t\r\n\t\tsuper.drawRec(ctx);\r\n\t\t\r\n\t\tif ( style.overflowHidden!=null&&style.overflowHidden ) {\r\n\t\t\tctx.flush();\r\n\t\t\tif( old == null )\tctx.engine.setRenderZone();\r\n\t\t\telse\t\t\t\tctx.engine.setRenderZone( Std.int(old.x), Std.int(old.y), Std.int(old.z), Std.int(old.w) );\r\n\t\t}\r\n\t\t\r\n\t}\r\n```\r\n\r\nThe AST is correct but scout shows that the closure is allocate 100% of the time even if control flow never ever gets in.\r\nThis is a major hidden cost.\r\n\r\nPlease check if the behaviour still exists and maybe take action. If your too short on time, i can take a look but i don't have a 3.2 environnment right here out of the box and reproducing can be complicated.\r\n"}}