In performance critical code, fields should not be given abstract types (see Performance Tips). Instead, you should parameterize your struct allowing the compiler to track the actual concrete type inside:
struct DwellIterParam{T, I, R}
data::T
dlast::I
x_lo::R
x_hi::R
function DwellIterParam(data::AbstractVector{R}, dlast::Integer, x_lo::R, x_hi::R) where {R<:Real}
new{typeof(data),typeof(dlast),R}(data, dlast, x_lo, x_hi)
end
end
Now, the compiler knows all types of the fields:
julia> DwellIterParam([1,2,3], 10, 1, 2)
DwellIterParam{Vector{Int64}, Int64, Int64}([1, 2, 3], 10, 1, 2)
julia> DwellIterParam([1.0,2.0,3.0], 10, 1.0, 2.0)
DwellIterParam{Vector{Float64}, Int64, Float64}([1.0, 2.0, 3.0], 10, 1.0, 2.0)