Wow ! Impressive difference, it is 100 time faster without sub() :
s = df[df[:rank_PV].<=r_max,:] @time write_results(s, name, "significant", sep, h) Saving... significant/Stat.csv 0.704880 seconds (7.14 M allocations: 164.687 MB, 2.40% gc time) s = sub(df, (df[:rank_PV] .<= r_max)) @time write_results(s, name, "significant", sep, h) Saving... significant/Stat.csv 86.797541 seconds (21.98 M allocations: 104.215 GB, 4.13% gc time) Thanks Alex !