-
Notifications
You must be signed in to change notification settings - Fork 28
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
Stack overflow for concatenation of large number of arrays #97
Comments
I found a way to create the lazy array such that the ApplyArray{T, N, typeof(vcat), NTuple{length(arrays),L}}(vcat, NTuple{length(arrays),L}(ntuple(i->arrays[i],length(arrays)))) |
Would you be able to make a PR? |
I could. Would the desired signature be something like Vcat(::AbstractArray{AbstractArray}) containing essentially ApplyArray{T, N, typeof(vcat), NTuple{length(arrays),L}}(vcat, NTuple{length(arrays),L}(ntuple(i->arrays[i],length(arrays)))) ? |
So your proposed signature is not good as it should return something equivalent to julia> vcat([[1,2],[3,4]])
2-element Array{Array{Int64,1},1}:
[1, 2]
[3, 4] Actually, I don't think you want julia> mortar([[1,2],[3,4]])
2-blocked 4-element BlockArray{Int64,1}:
1
2
─
3
4 Note this is already lazy (in the sense that it doesn't copy its arguments). |
Interesting, I was not aware of |
Perhaps you could add your work around to overload: Vcat(A::AbstractArray...) ? |
Methods using varargs are also troublesome if the number of arrays is large since the compiler will hit some limit for the number of arguments to a function. Overloading it does not help, the splatting of the vector of vectors must be avoided. |
The current way of constructing
Vcat
objects, by splatting/slurping, causes stack overflow when concatenating a large number of arrays since special methods of these functions are compiled for the particular number of input arguments.My usecase is LazyWAVFiles.jl which treats a folder of WAV files as one large array, such a folder may contain quite a lot of files...
The text was updated successfully, but these errors were encountered: