{"action":"opened","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/16631","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/16631/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/16631/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/16631/events","html_url":"https://github.com/JuliaLang/julia/issues/16631","id":157351530,"number":16631,"title":"Slow push! and unshift! for large number of arguments","user":{"login":"bkamins","id":6187170,"avatar_url":"https://avatars.githubusercontent.com/u/6187170?v=3","gravatar_id":"","url":"https://api.github.com/users/bkamins","html_url":"https://github.com/bkamins","followers_url":"https://api.github.com/users/bkamins/followers","following_url":"https://api.github.com/users/bkamins/following{/other_user}","gists_url":"https://api.github.com/users/bkamins/gists{/gist_id}","starred_url":"https://api.github.com/users/bkamins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkamins/subscriptions","organizations_url":"https://api.github.com/users/bkamins/orgs","repos_url":"https://api.github.com/users/bkamins/repos","events_url":"https://api.github.com/users/bkamins/events{/privacy}","received_events_url":"https://api.github.com/users/bkamins/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-28T18:36:31Z","updated_at":"2016-05-28T18:36:31Z","closed_at":null,"body":"The following code is slow (even if the `push!` and `unshift!` functions are run several times):\r\n\r\n```\r\nx = [1, 2, 3]\r\npush!(x, (1:10000)...) # this is very slow\r\nunshift!(x, (1:10000)...) # this is also very slow\r\n```\r\n\r\ncompared to:\r\n\r\n```\r\nx = [1, 2, 3]\r\nfor i in 1:10000\r\n    push!(x, i)\r\nend\r\nfor i in 1:10000\r\n    unshift!(x, i)\r\nend\r\n```\r\n\r\nFor smaller number of values (less than 10000) the speed of current implementation is not prohibitively low, but slower than loop.\r\n\r\nThe problem was encountered in `NullableArrays` (PR JuliaStats/NullableArrays.jl#110) and the solution comment by @nalimilan requires fixing the cases mentioned above."}}
{"actor":{"display_login":"bkamins"}}