When the function in map_dtc
returns a data.table
with many rows, map_dtc
appears to be slower than it needs to be by a factor of about 100.
system.time(mlr3misc::map_dtc(1:3, function(x) runif(1e6, max = x)))
#> user system elapsed
#> 0.043 0.000 0.044
system.time(mlr3misc::map_dtc(1:3, function(x) data.table(x = runif(1e6, max = x))))
#> user system elapsed
#> 5.124 0.006 5.147
profvis tells me this this is because name_dots
is called in data.table.