{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/53086","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/53086/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/53086/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/53086/events","html_url":"https://github.com/rust-lang/rust/pull/53086","id":347688924,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2MjMzNDE0","number":53086,"title":"Try to guess a smarter initial capacity in Vec::from_iter","user":{"login":"scottmcm","id":18526288,"node_id":"MDQ6VXNlcjE4NTI2Mjg4","avatar_url":"https://avatars2.githubusercontent.com/u/18526288?v=4","gravatar_id":"","url":"https://api.github.com/users/scottmcm","html_url":"https://github.com/scottmcm","followers_url":"https://api.github.com/users/scottmcm/followers","following_url":"https://api.github.com/users/scottmcm/following{/other_user}","gists_url":"https://api.github.com/users/scottmcm/gists{/gist_id}","starred_url":"https://api.github.com/users/scottmcm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottmcm/subscriptions","organizations_url":"https://api.github.com/users/scottmcm/orgs","repos_url":"https://api.github.com/users/scottmcm/repos","events_url":"https://api.github.com/users/scottmcm/events{/privacy}","received_events_url":"https://api.github.com/users/scottmcm/received_events","type":"User","site_admin":false},"labels":[{"id":921740159,"node_id":"MDU6TGFiZWw5MjE3NDAxNTk=","url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-perf","name":"S-waiting-on-perf","color":"c2cccc","default":false},{"id":583426710,"node_id":"MDU6TGFiZWw1ODM0MjY3MTA=","url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-review","name":"S-waiting-on-review","color":"d3dddd","default":false}],"state":"open","locked":false,"assignee":{"login":"kennytm","id":103023,"node_id":"MDQ6VXNlcjEwMzAyMw==","avatar_url":"https://avatars1.githubusercontent.com/u/103023?v=4","gravatar_id":"","url":"https://api.github.com/users/kennytm","html_url":"https://github.com/kennytm","followers_url":"https://api.github.com/users/kennytm/followers","following_url":"https://api.github.com/users/kennytm/following{/other_user}","gists_url":"https://api.github.com/users/kennytm/gists{/gist_id}","starred_url":"https://api.github.com/users/kennytm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennytm/subscriptions","organizations_url":"https://api.github.com/users/kennytm/orgs","repos_url":"https://api.github.com/users/kennytm/repos","events_url":"https://api.github.com/users/kennytm/events{/privacy}","received_events_url":"https://api.github.com/users/kennytm/received_events","type":"User","site_admin":false},"assignees":[{"login":"kennytm","id":103023,"node_id":"MDQ6VXNlcjEwMzAyMw==","avatar_url":"https://avatars1.githubusercontent.com/u/103023?v=4","gravatar_id":"","url":"https://api.github.com/users/kennytm","html_url":"https://github.com/kennytm","followers_url":"https://api.github.com/users/kennytm/followers","following_url":"https://api.github.com/users/kennytm/following{/other_user}","gists_url":"https://api.github.com/users/kennytm/gists{/gist_id}","starred_url":"https://api.github.com/users/kennytm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennytm/subscriptions","organizations_url":"https://api.github.com/users/kennytm/orgs","repos_url":"https://api.github.com/users/kennytm/repos","events_url":"https://api.github.com/users/kennytm/events{/privacy}","received_events_url":"https://api.github.com/users/kennytm/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2018-08-05T11:05:09Z","updated_at":"2018-08-05T13:59:13Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/53086","html_url":"https://github.com/rust-lang/rust/pull/53086","diff_url":"https://github.com/rust-lang/rust/pull/53086.diff","patch_url":"https://github.com/rust-lang/rust/pull/53086.patch"},"body":"> Another possibility is collect could look at the upper bound and be smarter about what capacity to use?  ~ https://github.com/rust-lang/rust/issues/45840#issuecomment-342949609\r\n\r\nThis is obviously good for hints like `(60, Some(61))` where today we allocate space for 60, then double it should the additional element show up, and it'd be much better to just always allocate 61.\r\n\r\nMore nuanced are hints like `(0, Some(150))`, where today the code uses just the `0`, and thus starts at a capacity of `1`, but with this change will start at `10` instead.\r\n\r\nThis can undeniably increase memory pressure over where it is today, so I expect at least some controversy :slightly_smiling_face:  It does use `try_reserve` for the allocation that's more than the lower bound, and thus shouldn't introduce new aborts, at least.  And the starting point grows by the root, keeping things fairly contained: even with an hint of `(0, Some(1_000_000_000))` it'll only start at `30_517`.\r\n\r\ncc @ljedrz \r\ncc https://github.com/rust-lang/rust/issues/48994"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/410522064","html_url":"https://github.com/rust-lang/rust/pull/53086#issuecomment-410522064","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/53086","id":410522064,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDUyMjA2NA==","user":{"login":"rust-timer","id":12471139,"node_id":"MDQ6VXNlcjEyNDcxMTM5","avatar_url":"https://avatars0.githubusercontent.com/u/12471139?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-timer","html_url":"https://github.com/rust-timer","followers_url":"https://api.github.com/users/rust-timer/followers","following_url":"https://api.github.com/users/rust-timer/following{/other_user}","gists_url":"https://api.github.com/users/rust-timer/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-timer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-timer/subscriptions","organizations_url":"https://api.github.com/users/rust-timer/orgs","repos_url":"https://api.github.com/users/rust-timer/repos","events_url":"https://api.github.com/users/rust-timer/events{/privacy}","received_events_url":"https://api.github.com/users/rust-timer/received_events","type":"User","site_admin":false},"created_at":"2018-08-05T13:59:13Z","updated_at":"2018-08-05T13:59:13Z","author_association":"NONE","body":"Success: Queued 8612aa2c66109e931d3a01a63797a5ddae8e332f with parent b47c314c5652c8ecc3f086b0326f467b857b9d5b, [comparison URL](https://perf.rust-lang.org/compare.html?start=b47c314c5652c8ecc3f086b0326f467b857b9d5b&end=8612aa2c66109e931d3a01a63797a5ddae8e332f)."}}
{"actor":{"display_login":"rust-timer"}}