{"action":"created","issue":{"url":"https://api.github.com/repos/benjamn/recast/issues/358","repository_url":"https://api.github.com/repos/benjamn/recast","labels_url":"https://api.github.com/repos/benjamn/recast/issues/358/labels{/name}","comments_url":"https://api.github.com/repos/benjamn/recast/issues/358/comments","events_url":"https://api.github.com/repos/benjamn/recast/issues/358/events","html_url":"https://github.com/benjamn/recast/pull/358","id":199645191,"number":358,"title":"Add option to avoid copying the AST","user":{"login":"jlongster","id":17031,"avatar_url":"https://avatars.githubusercontent.com/u/17031?v=3","gravatar_id":"","url":"https://api.github.com/users/jlongster","html_url":"https://github.com/jlongster","followers_url":"https://api.github.com/users/jlongster/followers","following_url":"https://api.github.com/users/jlongster/following{/other_user}","gists_url":"https://api.github.com/users/jlongster/gists{/gist_id}","starred_url":"https://api.github.com/users/jlongster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlongster/subscriptions","organizations_url":"https://api.github.com/users/jlongster/orgs","repos_url":"https://api.github.com/users/jlongster/repos","events_url":"https://api.github.com/users/jlongster/events{/privacy}","received_events_url":"https://api.github.com/users/jlongster/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-01-09T19:50:44Z","updated_at":"2017-01-09T20:54:22Z","closed_at":"2017-01-09T19:57:20Z","pull_request":{"url":"https://api.github.com/repos/benjamn/recast/pulls/358","html_url":"https://github.com/benjamn/recast/pull/358","diff_url":"https://github.com/benjamn/recast/pull/358.diff","patch_url":"https://github.com/benjamn/recast/pull/358.patch"},"body":"In my project, I'm using recast to parse a large file. The file is 2000 lines long. Running my project takes ~970ms. I profiled it under Chrome:\r\n\r\n<img width=\"772\" alt=\"screen shot 2017-01-09 at 2 47 46 pm\" src=\"https://cloud.githubusercontent.com/assets/17031/21780743/c2b982b8-d67a-11e6-9308-2d243b3e7feb.png\">\r\n\r\nYou can see the `TCp.copy` function is taking a large chunk of the time. I looked into it and it's because recast copies the entire ast before returning it. Turning this off, my project runs in ~660ms, about 2/3 the time. Copying a big AST has a big performance penalty so I think it's worth making this an option, and possibly even defaulting to `false`.\r\n\r\nShould the default be `false`? If so many projects using recast would see a 30% perf bump."},"comment":{"url":"https://api.github.com/repos/benjamn/recast/issues/comments/271404470","html_url":"https://github.com/benjamn/recast/pull/358#issuecomment-271404470","issue_url":"https://api.github.com/repos/benjamn/recast/issues/358","id":271404470,"user":{"login":"benjamn","id":5750,"avatar_url":"https://avatars.githubusercontent.com/u/5750?v=3","gravatar_id":"","url":"https://api.github.com/users/benjamn","html_url":"https://github.com/benjamn","followers_url":"https://api.github.com/users/benjamn/followers","following_url":"https://api.github.com/users/benjamn/following{/other_user}","gists_url":"https://api.github.com/users/benjamn/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamn/subscriptions","organizations_url":"https://api.github.com/users/benjamn/orgs","repos_url":"https://api.github.com/users/benjamn/repos","events_url":"https://api.github.com/users/benjamn/events{/privacy}","received_events_url":"https://api.github.com/users/benjamn/received_events","type":"User","site_admin":false},"created_at":"2017-01-09T20:54:22Z","updated_at":"2017-01-09T20:54:22Z","body":"Yeah, you should be able to pass any AST to `recast.print`, even if it didn't come from `recast.parse`."}}
{"actor":{"display_login":"benjamn"}}