Skip to content
Prev 55319 / 63424 Next

Subsetting the "ROW"s of an object

On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles <ccberry at ucsd.edu> wrote:
I think that's because you used a relatively low precision timing
mechnaism, and included the index generation in the timing. I see:

arr <- array(rnorm(2^22),c(2^10,4,4,4))
i <- seq(1,length = 10, by = 100)

bench::mark(
  arr[i, TRUE, TRUE, TRUE],
  arr[i, , , ]
)
#> # A tibble: 2 x 1
#>   expression        min    mean   median      max  n_gc
#>   <chr>         <bch:t> <bch:t> <bch:tm> <bch:tm> <dbl>
#> 1 arr[i, TRUE,?   7.4?s  10.9?s  10.66?s   1.22ms     2
#> 2 arr[i, , , ]   7.06?s   8.8?s   7.85?s 538.09?s     2

So not a huge difference, but it's there.

Hadley