-
Notifications
You must be signed in to change notification settings - Fork 23
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
promote_type stack overflow #160
Comments
A possible solution julia> function promote_type_array(T::Vector{DataType})
LT = T[1]
for i in 1:length(T)
LT = promote_type(LT, T[i])
end
return LT
end
promote_type_array (generic function with 1 method)
julia> type_array = [Int32 for i in 1:100000];
julia> promote_type_array(type_array)
Int32 |
Yeah, that is true. Could you please help implement this change by submitting a PR? |
After using the reduce function the code seems much better julia> type_array = [Int32 for i in 1:10000];
julia> @btime reduce($promote_type, $type_array)
663.625 μs (0 allocations: 0 bytes)
Int32 I will submit a PR for that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In
the function
promote_type
is directly used and I found when theeltype.(ixs)
is large (greater that 10000 for example), it causes stack overflow.The text was updated successfully, but these errors were encountered: