{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/31966","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/31966/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/31966/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/31966/events","html_url":"https://github.com/rust-lang/rust/pull/31966","id":137288972,"number":31966,"title":"fmt: Skip calling write_str for empty strings","user":{"login":"bluss","id":3209739,"avatar_url":"https://avatars.githubusercontent.com/u/3209739?v=3","gravatar_id":"","url":"https://api.github.com/users/bluss","html_url":"https://github.com/bluss","followers_url":"https://api.github.com/users/bluss/followers","following_url":"https://api.github.com/users/bluss/following{/other_user}","gists_url":"https://api.github.com/users/bluss/gists{/gist_id}","starred_url":"https://api.github.com/users/bluss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluss/subscriptions","organizations_url":"https://api.github.com/users/bluss/orgs","repos_url":"https://api.github.com/users/bluss/repos","events_url":"https://api.github.com/users/bluss/events{/privacy}","received_events_url":"https://api.github.com/users/bluss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-02-29T15:40:02Z","updated_at":"2016-02-29T15:40:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/31966","html_url":"https://github.com/rust-lang/rust/pull/31966","diff_url":"https://github.com/rust-lang/rust/pull/31966.diff","patch_url":"https://github.com/rust-lang/rust/pull/31966.patch"},"body":"fmt: Skip calling write_str for empty strings\r\n\r\n`format_args!` uses one string literal per used `{}`, in many cases, the\r\nseparating string pieces are empty.\r\n\r\nFor example, `write!(w, \"{}\", x);` will attempt to write one empty\r\nstring before the `{}` format, and `write!(w, \"{}{}{}\", x, y, z);\" will\r\nwrite three empty string pieces between formats.\r\n\r\nSimply skip writing if the string is empty. It is a cheap branch\r\ncompared to the virtual Write::write_str call that it makes possible to\r\nskip.\r\n\r\nIt does not solve issue #10761 in any way, yet that's where I noticed\r\nthis. The testcase in the issue shows a performance difference between\r\n`write!(w, \"abc\")` and `write!(w, \"{}\", \"abc\")`, and this change halves\r\nthe size of the difference."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/190261185","html_url":"https://github.com/rust-lang/rust/pull/31966#issuecomment-190261185","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/31966","id":190261185,"user":{"login":"rust-highfive","id":7378925,"avatar_url":"https://avatars.githubusercontent.com/u/7378925?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-highfive","html_url":"https://github.com/rust-highfive","followers_url":"https://api.github.com/users/rust-highfive/followers","following_url":"https://api.github.com/users/rust-highfive/following{/other_user}","gists_url":"https://api.github.com/users/rust-highfive/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-highfive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-highfive/subscriptions","organizations_url":"https://api.github.com/users/rust-highfive/orgs","repos_url":"https://api.github.com/users/rust-highfive/repos","events_url":"https://api.github.com/users/rust-highfive/events{/privacy}","received_events_url":"https://api.github.com/users/rust-highfive/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T15:40:15Z","updated_at":"2016-02-29T15:40:15Z","body":"r? @alexcrichton\n\n(rust_highfive has picked a reviewer for you, use r? to override)"}}