using StatsBase, InvertedIndices
24 Profiling
= randn(Float64, 50000, 500); x
= sample(collect(1:5000), 2500, replace=false); idi
The @time
macro is an easy way to time execution and get stats on allocations.
Here, we compare negative indexing using InvertedIndices.jl
’s Not
vs. Rtemis.jl
’s excl()
to exclude a subset of cases. (The latter is included in Rtemis.jl
to allow fast indexing of testing cases after getting training set indexes)
@time xe1 = x[Not(idi), :];
4.037141 seconds (167.35 M allocations: 4.520 GiB, 8.30% gc time, 1.93% compilation time)
@time xe2 = excl(x, idi);