Performance: read data from ascii file, replace `split`

Some other suggestions I have: CSV.jl is multi-threaded by default so this might affect timings. Also it uses GitHub - JuliaStrings/InlineStrings.jl: Fixed-width string types for Julia which helps a lot to avoid allocations. Tried unrolling the loop - this helps a bit but maybe bottleneck now is not in split logic.

@inbounds function parse_str_unrolled(str)
    ix_beg = findfirst((==)(' '), str)
    ix_end = findnext((==)(' '), str, ix_beg+1)
    a = str[1:ix_beg-1]
    b = @views parse(Int, str[ix_beg+1:ix_end-1])
    c = @views parse(Float64, str[ix_end+1:end])
    (a, b, c)
end
1 Like