Naively I would expect that dropping columns (in place) from a DataFrame
with select!
would be a very cheap operation, on the order of nanoseconds. But I’m getting times in the microsecond range:
julia> using DataFrames, BenchmarkTools
julia> @benchmark select!(df, :a) evals=1 setup=(df = DataFrame(a=rand(10_000), b = rand(10_000)))
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 1.431 μs … 8.846 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.916 μs ┊ GC (median): 0.00%
Time (mean ± σ): 1.965 μs ± 272.973 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▂▄▆▆▆█▆▆▆▅▄▃▂▂▁
▂▁▂▂▂▂▂▂▂▂▃▄▅▆██████████████████▇▇▆▆▆▅▅▄▄▃▄▃▃▃▃▃▃▃▃▃▂▂▂▂▂▂▂ ▄
1.43 μs Histogram: frequency by time 2.65 μs <
Memory estimate: 1.78 KiB, allocs estimate: 24.
Am I doing something wrong here?