CSV.jl type stability

Type stability is a property of sort of compile time…

if I call abc(d,e) and the compiler can’t determine from context that d and e are always a Float64 and an Int64 then it can’t just call the abc(d::Float64,e::Int64) method directly, it will have to do dynamic dispatch (meaning look at the runtime for what the types are, and then look up that method in the method table).

I think what you might do is something like:

for row in CSV.Rows(file,types=[Int64,Float64,String])
   push!(myvals,MyCustomType(a = row.a::Int64, b = row.b::Float64, c = row.c::String)
end

Which will allow the compiler to know the values and which constructor to call…

1 Like