-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow push! and unshift! for large number of arguments #16631
Comments
The issue is the splatting because you effectively call a function with 10001 arguments. Wouldn't |
I will have to check. But see below that the loop is reasonably fast even with splatting so why not fix it?
|
Calling a function with splatting of an container is a bad idea. The multi-args push and unshift are optimized for a small number of arguments. |
Sorry if my comment on the other issue wasn't explicit enough, but I meant that there was no performance issue here. |
The following code is slow (even if the
push!
andunshift!
functions are run several times):compared to:
For smaller number of values (less than 10000) the speed of current implementation is not prohibitively low, but slower than loop.
The problem was encountered in
NullableArrays
(PR JuliaStats/NullableArrays.jl#110) and the solution comment by @nalimilan requires fixing the cases mentioned above.The text was updated successfully, but these errors were encountered: