You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Random
using BenchmarkTools
using DataFrames
sdf = DataFrame()
sdf[!, "SOME_STR"] = [Random.randstring() for i in 1:1_000_000]
sdf[!, "SOME_FLT"] = [Random.rand() for i in 1:1_000_000]
@btime filter(row -> occursin("E8", row.SOME_STR), sdf); # ---> 126.400 ms
@btime sdf[occursin.("E8", sdf[!, "SOME_STR"]), :]; # ---> 56.947 ms
@btime filter(row -> row.SOME_FLT > 0.5, sdf); # ---> 126.400 ms
@btime sdf[sdf[!, "SOME_FLT"] .> 0.5, :]; # ---> 4.093 ms
Actually, I like code with filter more, but speed in some cases is much worse. Am I doing something wrong? Or filter does much more under the hood that cause this speed regression?
Cheers,
Lubo
The text was updated successfully, but these errors were encountered:
Hello,
using julia 1.8.2, DataFrames 1.4.1
Suppose this code:
Actually, I like code with filter more, but speed in some cases is much worse. Am I doing something wrong? Or filter does much more under the hood that cause this speed regression?
Cheers,
Lubo
The text was updated successfully, but these errors were encountered: