{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/10607","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/10607/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/10607/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/10607/events","html_url":"https://github.com/rust-lang/rust/issues/10607","id":23132453,"number":10607,"title":"Macro expansion is quadratic in the number of `let` statements.","user":{"login":"huonw","id":1203825,"avatar_url":"https://avatars.githubusercontent.com/u/1203825?v=3","gravatar_id":"","url":"https://api.github.com/users/huonw","html_url":"https://github.com/huonw","followers_url":"https://api.github.com/users/huonw/followers","following_url":"https://api.github.com/users/huonw/following{/other_user}","gists_url":"https://api.github.com/users/huonw/gists{/gist_id}","starred_url":"https://api.github.com/users/huonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huonw/subscriptions","organizations_url":"https://api.github.com/users/huonw/orgs","repos_url":"https://api.github.com/users/huonw/repos","events_url":"https://api.github.com/users/huonw/events{/privacy}","received_events_url":"https://api.github.com/users/huonw/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-compiletime","name":"I-compiletime","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2013-11-22T11:47:53Z","updated_at":"2016-07-15T19:43:29Z","closed_at":"2016-07-15T19:43:29Z","body":"The following (bash) shell snippet prints `let _x: int; /* <number> */ ` 5000 times, which makes the compiler very unhappy.\r\n\r\n```\r\n$ echo 'fn main() { ' 'let _x: int; /*'{1..5000}'*/' '}'  |  rustc - -Z time-passes\r\ntime: 0.056 s   parsing\r\ntime: 0.001 s   gated feature checking\r\ntime: 0.002 s   std macros injection\r\ntime: 0.010 s   configuration 1\r\ntime: 9.157 s   expansion\r\n[...]\r\n```\r\n\r\n(the total time is 10.3s.)\r\n\r\nFirst few lines of `perf report`:\r\n\r\n```\r\n    32.15%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] hash::Writer$SipState::write::hadb05778635375a2fhaT::v0.9$x2dpre\r\n    22.41%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] hashmap::HashMap::bucket_for_key_with_hash::h5b953adb9726637Rjab::v0.9$x2dpre\r\n     9.02%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] hash::Streaming$SipState::result_u64::h1e5a7083bc4c3f6bAga7::v0.9$x2dpre\r\n     8.46%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] hash::Hash$A::hash_keyed::h463e3d8e059f531Zha5::v0.9$x2dpre\r\n     4.20%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] ast_util::get_sctable::he0d4d721b1287a6aH::v0.9$x2dpre\r\n     3.08%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] hashmap::Map$HashMap::find::hf199eda9a92cb3f3CAa3::v0.9$x2dpre\r\n     1.72%     rustc  libsyntax-2bb2d559d93ae8f0-0.9-pre.so  [.] tuple::inner::Eq$__extensions__::eq::h4384d9b129d29aa7Gjas::v0.9$x2dpre            ```\r\n```\r\n\r\ni.e. ~70% of the time is spend on hashing/hashmap look-ups. (cc https://github.com/mozilla/rust/issues/10586, although that's not the full problem.)"}}
{"actor":{"display_login":"bors"}}