{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/14441","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/14441/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/14441/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/14441/events","html_url":"https://github.com/JuliaLang/julia/pull/14441","id":123040308,"number":14441,"title":"Minor Array constructor tweaks","user":{"login":"mbauman","id":154641,"avatar_url":"https://avatars.githubusercontent.com/u/154641?v=3","gravatar_id":"","url":"https://api.github.com/users/mbauman","html_url":"https://github.com/mbauman","followers_url":"https://api.github.com/users/mbauman/followers","following_url":"https://api.github.com/users/mbauman/following{/other_user}","gists_url":"https://api.github.com/users/mbauman/gists{/gist_id}","starred_url":"https://api.github.com/users/mbauman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbauman/subscriptions","organizations_url":"https://api.github.com/users/mbauman/orgs","repos_url":"https://api.github.com/users/mbauman/repos","events_url":"https://api.github.com/users/mbauman/events{/privacy}","received_events_url":"https://api.github.com/users/mbauman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-12-18T22:58:30Z","updated_at":"2016-01-05T16:22:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/14441","html_url":"https://github.com/JuliaLang/julia/pull/14441","diff_url":"https://github.com/JuliaLang/julia/pull/14441.diff","patch_url":"https://github.com/JuliaLang/julia/pull/14441.patch"},"body":"This removes an unnecessary tuple allocation when constructing 1-3 dimensional arrays with a single tuple argument.  Notably, this is the form that ends up getting called by `similar`.  Before:\r\n\r\n```jl\r\njulia> @benchmark Array{Int}(1,1,1)\r\n================ Benchmark Results ========================\r\n     Time per evaluation: 67.50 ns [66.48 ns, 68.52 ns]\r\nProportion of time in GC: 2.00% [1.45%, 2.56%]\r\n        Memory allocated: 80.00 bytes\r\n   Number of allocations: 1 allocations\r\n\r\njulia> @benchmark Array{Int}((1,1,1))\r\n================ Benchmark Results ========================\r\n     Time per evaluation: 132.95 ns [129.50 ns, 136.39 ns]\r\nProportion of time in GC: 1.96% [1.35%, 2.58%]\r\n        Memory allocated: 112.00 bytes\r\n   Number of allocations: 2 allocations\r\n```\r\n\r\nAfter:\r\n\r\n```jl\r\njulia> @benchmark Array{Int}(1,1,1)\r\n================ Benchmark Results ========================\r\n     Time per evaluation: 62.19 ns [61.18 ns, 63.20 ns]\r\nProportion of time in GC: 2.20% [1.62%, 2.78%]\r\n        Memory allocated: 80.00 bytes\r\n   Number of allocations: 1 allocations\r\n\r\njulia> @benchmark Array{Int}((1,1,1))\r\n================ Benchmark Results ========================\r\n     Time per evaluation: 62.44 ns [61.45 ns, 63.43 ns]\r\nProportion of time in GC: 2.23% [1.65%, 2.82%]\r\n        Memory allocated: 80.00 bytes\r\n   Number of allocations: 1 allocations\r\n```\r\n\r\nWhile I was there, I also cleaned up the constructor functions themselves a bit, such that the fully-parametrized Array{T,N} was the final endpoint.  It makes things simpler and a bit more consistent; before constructs like `Array{Int,3}(1,2,3)` and `Matrix{Int}((1,2))` were missing method errors… but you might expect them to work."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/169049577","html_url":"https://github.com/JuliaLang/julia/pull/14441#issuecomment-169049577","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/14441","id":169049577,"user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T16:22:43Z","updated_at":"2016-01-05T16:22:43Z","body":"In the meantime, you could also compare against the parent commit (b33c4bd)."}}