24  Profiling

using StatsBase, InvertedIndices
x = randn(Float64, 50000, 500);
idi = sample(collect(1:5000), 2500, replace=false);

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);