colRowAnyMissings_subset - HenrikBengtsson/matrixStats GitHub Wiki

matrixStats: Benchmark report


colAnyMissings() and rowAnyMissings() benchmarks on subsetted computation

This report benchmark the performance of colAnyMissings() and rowAnyMissings() on subsetted computation.

Data type "integer"

Data

> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100, 
+     +100), na_prob = 0) {
+     mode <- match.arg(mode)
+     n <- nrow * ncol
+     if (mode == "logical") {
+         x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+     }     else if (mode == "index") {
+         x <- seq_len(n)
+         mode <- "integer"
+     }     else {
+         x <- runif(n, min = range[1], max = range[2])
+     }
+     storage.mode(x) <- mode
+     if (na_prob > 0) 
+         x[sample(n, size = na_prob * n)] <- NA
+     dim(x) <- c(nrow, ncol)
+     x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+     set.seed(seed)
+     data <- list()
+     data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+     data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+     data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+     data[[4]] <- t(data[[3]])
+     data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+     data[[6]] <- t(data[[5]])
+     names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+     data
+ }
> data <- rmatrices(mode = mode)

Results

10x10 matrix

> X <- data[["10x10"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065936 163.8    5709258 305.0  5709258 305.0
Vcells 5341036  40.8   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065230 163.8    5709258 305.0  5709258 305.0
Vcells 5339141  40.8   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.001909 0.0019595 0.0037601 0.0020160 0.0021555 0.170367
2 colAnyMissings(X, rows, cols) 0.002069 0.0021475 0.0022611 0.0021930 0.0023560 0.003318
3 colAnyMissings(X[rows, cols]) 0.002522 0.0027580 0.0029657 0.0028885 0.0030180 0.007057
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.0000000 1.000000 1.000000 1.0000000
2 colAnyMissings(X, rows, cols) 1.083813 1.095943 0.6013409 1.087798 1.093018 0.0194756
3 colAnyMissings(X[rows, cols]) 1.321111 1.407502 0.7887252 1.432788 1.400139 0.0414223

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on integer+10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.001856 0.0019250 0.0020304 0.0019705 0.0021025 0.003570
2 rowAnyMissings(X, cols, rows) 0.002044 0.0021135 0.0041019 0.0021665 0.0023205 0.188377
3 rowAnyMissings(X[cols, rows]) 0.002513 0.0026915 0.0029238 0.0028200 0.0029870 0.006586
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings(X, cols, rows) 1.101293 1.097922 2.020217 1.099467 1.103686 52.766667
3 rowAnyMissings(X[cols, rows]) 1.353987 1.398182 1.439971 1.431109 1.420690 1.844818

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+10x10 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+10x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
2 rowAnyMissings_X_S 1.856 1.9250 2.03043 1.9705 2.1025 3.570
1 colAnyMissings_X_S 1.909 1.9595 3.76008 2.0160 2.1555 170.367
expr min lq mean median uq max
2 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.00000
1 colAnyMissings_X_S 1.028556 1.017922 1.851864 1.023091 1.025208 47.72185

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

100x100 matrix

> X <- data[["100x100"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3064172 163.7    5709258 305.0  5709258 305.0
Vcells 5173566  39.5   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3064166 163.7    5709258 305.0  5709258 305.0
Vcells 5178649  39.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.003790 0.0041370 0.0043720 0.0043335 0.0044730 0.008098
2 colAnyMissings(X, rows, cols) 0.005891 0.0061995 0.0065557 0.0064130 0.0066940 0.010122
3 colAnyMissings(X[rows, cols]) 0.011714 0.0120525 0.0129000 0.0122175 0.0123705 0.064254
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 1.554354 1.498550 1.499486 1.479866 1.496535 1.249938
3 colAnyMissings(X[rows, cols]) 3.090765 2.913343 2.950638 2.819315 2.765594 7.934552

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on integer+100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.005676 0.0060965 0.0062394 0.0062255 0.0063330 0.008932
2 rowAnyMissings(X, cols, rows) 0.006729 0.0070995 0.0072964 0.0072915 0.0074340 0.008109
3 rowAnyMissings(X[cols, rows]) 0.013574 0.0138655 0.0147486 0.0140695 0.0142865 0.065044
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings(X, cols, rows) 1.185518 1.164521 1.169415 1.171231 1.173851 0.9078594
3 rowAnyMissings(X[cols, rows]) 2.391473 2.274338 2.363802 2.259979 2.255882 7.2821317

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+100x100 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+100x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 3.790 4.1370 4.37195 4.3335 4.473 8.098
2 rowAnyMissings_X_S 5.676 6.0965 6.23936 6.2255 6.333 8.932
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings_X_S 1.497625 1.473652 1.427134 1.436599 1.415828 1.102988

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

1000x10 matrix

> X <- data[["1000x10"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3064927 163.7    5709258 305.0  5709258 305.0
Vcells 5177649  39.6   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3064918 163.7    5709258 305.0  5709258 305.0
Vcells 5182727  39.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.003337 0.0034765 0.0036353 0.0035440 0.0037090 0.007212
2 colAnyMissings(X, rows, cols) 0.005597 0.0057760 0.0063044 0.0058625 0.0059715 0.047710
3 colAnyMissings(X[rows, cols]) 0.011065 0.0112440 0.0116576 0.0114140 0.0115550 0.021089
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 1.677255 1.661441 1.734219 1.654204 1.610003 6.615363
3 colAnyMissings(X[rows, cols]) 3.315853 3.234287 3.206809 3.220655 3.115395 2.924154

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on integer+1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.005047 0.005165 0.0057156 0.0052435 0.0053455 0.048233
2 rowAnyMissings(X, cols, rows) 0.007300 0.007551 0.0078297 0.0076545 0.0078965 0.020284
3 rowAnyMissings(X[cols, rows]) 0.013611 0.013890 0.0144229 0.0140400 0.0142650 0.031846
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings(X, cols, rows) 1.446404 1.461955 1.369894 1.459807 1.477224 0.4205420
3 rowAnyMissings(X[cols, rows]) 2.696850 2.689255 2.523438 2.677601 2.668600 0.6602534

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+1000x10 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+1000x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 3.337 3.4765 3.63528 3.5440 3.7090 7.212
2 rowAnyMissings_X_S 5.047 5.1650 5.71556 5.2435 5.3455 48.233
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.00000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings_X_S 1.512436 1.48569 1.572248 1.479543 1.441224 6.687881

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

10x1000 matrix

> X <- data[["10x1000"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065130 163.7    5709258 305.0  5709258 305.0
Vcells 5178556  39.6   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065124 163.7    5709258 305.0  5709258 305.0
Vcells 5183639  39.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.005520 0.005975 0.0064180 0.0063365 0.0066215 0.010772
2 colAnyMissings(X, rows, cols) 0.008137 0.008464 0.0095423 0.0087120 0.0090540 0.054838
3 colAnyMissings(X[rows, cols]) 0.014095 0.014756 0.0155108 0.0150345 0.0155315 0.027018
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 1.474094 1.416569 1.486790 1.374891 1.367364 5.090791
3 colAnyMissings(X[rows, cols]) 2.553442 2.469623 2.416756 2.372682 2.345617 2.508169

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on integer+10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.005640 0.0059070 0.0063388 0.0061085 0.0062825 0.023325
2 rowAnyMissings(X, cols, rows) 0.007668 0.0081840 0.0083983 0.0083160 0.0085730 0.009478
3 rowAnyMissings(X[cols, rows]) 0.012934 0.0132615 0.0136877 0.0134640 0.0137020 0.026768
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings(X, cols, rows) 1.359574 1.385475 1.324898 1.361382 1.364584 0.4063451
3 rowAnyMissings(X[cols, rows]) 2.293262 2.245048 2.159350 2.204142 2.180979 1.1476099

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+10x1000 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+10x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
2 rowAnyMissings_X_S 5.64 5.907 6.33882 6.1085 6.2825 23.325
1 colAnyMissings_X_S 5.52 5.975 6.41804 6.3365 6.6215 10.772
expr min lq mean median uq max
2 rowAnyMissings_X_S 1.0000000 1.000000 1.000000 1.000000 1.000000 1.0000000
1 colAnyMissings_X_S 0.9787234 1.011512 1.012498 1.037325 1.053959 0.4618221

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

100x1000 matrix

> X <- data[["100x1000"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065329 163.8    5709258 305.0  5709258 305.0
Vcells 5201233  39.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065323 163.8    5709258 305.0  5709258 305.0
Vcells 5251316  40.1   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.017729 0.0180670 0.0185983 0.0182870 0.018740 0.026048
2 colAnyMissings(X, rows, cols) 0.039803 0.0402135 0.0414919 0.0404055 0.040672 0.131804
3 colAnyMissings(X[rows, cols]) 0.089306 0.0901435 0.0912248 0.0905265 0.091298 0.109593
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.00000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 2.245079 2.225798 2.230946 2.20952 2.170331 5.060043
3 colAnyMissings(X[rows, cols]) 5.037284 4.989401 4.905000 4.95032 4.871825 4.207348

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on integer+100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.029521 0.029851 0.0309257 0.0301030 0.0305360 0.068836
2 rowAnyMissings(X, cols, rows) 0.047036 0.048007 0.0486352 0.0485220 0.0488455 0.061143
3 rowAnyMissings(X[cols, rows]) 0.092687 0.093354 0.0947319 0.0936185 0.0940835 0.155660
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings(X, cols, rows) 1.593306 1.608221 1.572648 1.611866 1.599604 0.8882416
3 rowAnyMissings(X[cols, rows]) 3.139697 3.127332 3.063210 3.109939 3.081068 2.2613168

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+100x1000 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+100x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 17.729 18.067 18.59834 18.287 18.740 26.048
2 rowAnyMissings_X_S 29.521 29.851 30.92570 30.103 30.536 68.836
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.00000 1.000000 1.000000 1.00000
2 rowAnyMissings_X_S 1.665125 1.652239 1.66282 1.646142 1.629456 2.64266

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

1000x100 matrix

> X <- data[["1000x100"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065545 163.8    5709258 305.0  5709258 305.0
Vcells 5202044  39.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065539 163.8    5709258 305.0  5709258 305.0
Vcells 5252127  40.1   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.016552 0.0170740 0.0175829 0.0172730 0.0174835 0.028990
2 colAnyMissings(X, rows, cols) 0.034511 0.0349505 0.0356907 0.0353990 0.0356475 0.066961
3 colAnyMissings(X[rows, cols]) 0.079512 0.0805000 0.0822047 0.0808285 0.0811980 0.174185
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 2.085005 2.047001 2.029856 2.049383 2.038922 2.309797
3 colAnyMissings(X[rows, cols]) 4.803770 4.714771 4.675273 4.679471 4.644265 6.008451

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on integer+1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.035522 0.0381455 0.0384376 0.0383265 0.0385185 0.044317
2 rowAnyMissings(X, cols, rows) 0.048749 0.0495450 0.0498992 0.0497760 0.0502710 0.054800
3 rowAnyMissings(X[cols, rows]) 0.107349 0.1093065 0.1110342 0.1097290 0.1102325 0.218301
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings(X, cols, rows) 1.372361 1.298843 1.298187 1.298736 1.305113 1.236546
3 rowAnyMissings(X[cols, rows]) 3.022043 2.865515 2.888685 2.863006 2.861807 4.925897

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on integer+1000x100 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+1000x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 16.552 17.0740 17.58287 17.2730 17.4835 28.990
2 rowAnyMissings_X_S 35.522 38.1455 38.43761 38.3265 38.5185 44.317
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000
2 rowAnyMissings_X_S 2.146085 2.234128 2.186083 2.218868 2.203134 1.5287

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on integer+1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

Data type "double"

Data

> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100, 
+     +100), na_prob = 0) {
+     mode <- match.arg(mode)
+     n <- nrow * ncol
+     if (mode == "logical") {
+         x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+     }     else if (mode == "index") {
+         x <- seq_len(n)
+         mode <- "integer"
+     }     else {
+         x <- runif(n, min = range[1], max = range[2])
+     }
+     storage.mode(x) <- mode
+     if (na_prob > 0) 
+         x[sample(n, size = na_prob * n)] <- NA
+     dim(x) <- c(nrow, ncol)
+     x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+     set.seed(seed)
+     data <- list()
+     data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+     data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+     data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+     data[[4]] <- t(data[[3]])
+     data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+     data[[6]] <- t(data[[5]])
+     names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+     data
+ }
> data <- rmatrices(mode = mode)

Results

10x10 matrix

> X <- data[["10x10"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065763 163.8    5709258 305.0  5709258 305.0
Vcells 5293175  40.4   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065748 163.8    5709258 305.0  5709258 305.0
Vcells 5293343  40.4   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.001948 0.0020155 0.0024903 0.0020750 0.0022520 0.036719
2 colAnyMissings(X, rows, cols) 0.002164 0.0022700 0.0024112 0.0023315 0.0024785 0.005347
3 colAnyMissings(X[rows, cols]) 0.002686 0.0029695 0.0031934 0.0030695 0.0032235 0.010134
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.0000000 1.000000 1.000000 1.0000000
2 colAnyMissings(X, rows, cols) 1.110883 1.126271 0.9682526 1.123614 1.100577 0.1456194
3 colAnyMissings(X[rows, cols]) 1.378850 1.473332 1.2823618 1.479277 1.431394 0.2759879

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on double+10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.001837 0.0018920 0.0020309 0.0019375 0.0020740 0.004130
2 rowAnyMissings(X, cols, rows) 0.002025 0.0020890 0.0025987 0.0021775 0.0023310 0.039935
3 rowAnyMissings(X[cols, rows]) 0.002446 0.0026765 0.0029030 0.0027715 0.0029345 0.008181
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings(X, cols, rows) 1.102341 1.104123 1.279616 1.123871 1.123915 9.669491
3 rowAnyMissings(X[cols, rows]) 1.331519 1.414641 1.429463 1.430452 1.414899 1.980872

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+10x10 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+10x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
2 rowAnyMissings_X_S 1.837 1.8920 2.03086 1.9375 2.074 4.130
1 colAnyMissings_X_S 1.948 2.0155 2.49028 2.0750 2.252 36.719
expr min lq mean median uq max
2 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
1 colAnyMissings_X_S 1.060425 1.065275 1.226219 1.070968 1.085824 8.890799

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

100x100 matrix

> X <- data[["100x100"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065965 163.8    5709258 305.0  5709258 305.0
Vcells 5299161  40.5   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3065959 163.8    5709258 305.0  5709258 305.0
Vcells 5309244  40.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.004635 0.0049965 0.0052026 0.005118 0.0052700 0.009944
2 colAnyMissings(X, rows, cols) 0.007557 0.0079585 0.0083626 0.008119 0.0082595 0.020535
3 colAnyMissings(X[rows, cols]) 0.020516 0.0209150 0.0218574 0.021080 0.0213025 0.074657
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 1.630421 1.592815 1.607395 1.586362 1.567268 2.065064
3 colAnyMissings(X[rows, cols]) 4.426322 4.185930 4.201261 4.118796 4.042220 7.507743

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on double+100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.004956 0.0053805 0.0055589 0.0054995 0.0056570 0.009329
2 rowAnyMissings(X, cols, rows) 0.007678 0.0082480 0.0084524 0.0084380 0.0085520 0.012560
3 rowAnyMissings(X[cols, rows]) 0.012345 0.0129325 0.0136767 0.0131115 0.0133365 0.067858
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings(X, cols, rows) 1.549233 1.532943 1.520507 1.534321 1.511755 1.346339
3 rowAnyMissings(X[cols, rows]) 2.490920 2.403587 2.460315 2.384126 2.357522 7.273877

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+100x100 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+100x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 4.635 4.9965 5.20259 5.1180 5.270 9.944
2 rowAnyMissings_X_S 4.956 5.3805 5.55891 5.4995 5.657 9.329
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings_X_S 1.069256 1.076854 1.068489 1.074541 1.073435 0.9381537

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

1000x10 matrix

> X <- data[["1000x10"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066174 163.8    5709258 305.0  5709258 305.0
Vcells 5300620  40.5   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066168 163.8    5709258 305.0  5709258 305.0
Vcells 5310703  40.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.004123 0.0043245 0.0045103 0.0044505 0.0045635 0.009336
2 colAnyMissings(X, rows, cols) 0.007219 0.0074250 0.0080249 0.0075595 0.0077200 0.052019
3 colAnyMissings(X[rows, cols]) 0.020077 0.0203155 0.0205638 0.0204295 0.0205430 0.028397
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 1.750909 1.716962 1.779241 1.698573 1.691684 5.571872
3 colAnyMissings(X[rows, cols]) 4.869512 4.697768 4.559287 4.590383 4.501589 3.041667

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on double+1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.004964 0.005149 0.0056016 0.0052620 0.0053795 0.034969
2 rowAnyMissings(X, cols, rows) 0.008852 0.009071 0.0096919 0.0092185 0.0093375 0.043440
3 rowAnyMissings(X[cols, rows]) 0.014473 0.014720 0.0150551 0.0148750 0.0150685 0.020760
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings(X, cols, rows) 1.783239 1.761701 1.730213 1.751900 1.735756 1.2422431
3 rowAnyMissings(X[cols, rows]) 2.915592 2.858808 2.687663 2.826872 2.801097 0.5936687

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+1000x10 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+1000x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 4.123 4.3245 4.51031 4.4505 4.5635 9.336
2 rowAnyMissings_X_S 4.964 5.1490 5.60157 5.2620 5.3795 34.969
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.00000 1.000000
2 rowAnyMissings_X_S 1.203978 1.190658 1.241948 1.182339 1.17881 3.745608

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

10x1000 matrix

> X <- data[["10x1000"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066380 163.8    5709258 305.0  5709258 305.0
Vcells 5300757  40.5   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066374 163.8    5709258 305.0  5709258 305.0
Vcells 5310840  40.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.005969 0.0062765 0.0065605 0.0064860 0.0067145 0.010070
2 colAnyMissings(X, rows, cols) 0.010097 0.0105125 0.0112457 0.0106505 0.0108455 0.061931
3 colAnyMissings(X[rows, cols]) 0.015696 0.0160795 0.0164897 0.0162740 0.0166875 0.022871
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 1.691573 1.674898 1.714166 1.642075 1.615236 6.150050
3 colAnyMissings(X[rows, cols]) 2.629586 2.561858 2.513495 2.509097 2.485293 2.271202

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on double+10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.005782 0.0061200 0.0065552 0.0062550 0.0064965 0.026689
2 rowAnyMissings(X, cols, rows) 0.008904 0.0092125 0.0095146 0.0094825 0.0096375 0.013595
3 rowAnyMissings(X[cols, rows]) 0.013701 0.0141780 0.0146415 0.0144220 0.0146505 0.028200
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAnyMissings(X, cols, rows) 1.539952 1.505310 1.451461 1.515987 1.483491 0.5093859
3 rowAnyMissings(X[cols, rows]) 2.369595 2.316667 2.233576 2.305675 2.255137 1.0566151

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+10x1000 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+10x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
2 rowAnyMissings_X_S 5.782 6.1200 6.55518 6.255 6.4965 26.689
1 colAnyMissings_X_S 5.969 6.2765 6.56046 6.486 6.7145 10.070
expr min lq mean median uq max
2 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.00000 1.000000 1.000000
1 colAnyMissings_X_S 1.032342 1.025572 1.000806 1.03693 1.033556 0.377309

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

100x1000 matrix

> X <- data[["100x1000"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066579 163.8    5709258 305.0  5709258 305.0
Vcells 5346251  40.8   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066573 163.8    5709258 305.0  5709258 305.0
Vcells 5446334  41.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.025480 0.0261915 0.0272354 0.0265800 0.0271455 0.041650
2 colAnyMissings(X, rows, cols) 0.054747 0.0552735 0.0574334 0.0557780 0.0566840 0.176827
3 colAnyMissings(X[rows, cols]) 0.174996 0.1778275 0.1819949 0.1803625 0.1838225 0.246418
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 2.148626 2.110360 2.108780 2.098495 2.088155 4.245546
3 colAnyMissings(X[rows, cols]) 6.867975 6.789512 6.682299 6.785647 6.771749 5.916399

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on double+100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.030262 0.0309365 0.0345776 0.0319325 0.0349330 0.065825
2 rowAnyMissings(X, cols, rows) 0.061381 0.0617900 0.0659395 0.0624655 0.0653245 0.106891
3 rowAnyMissings(X[cols, rows]) 0.098686 0.1004695 0.1091581 0.1031840 0.1077745 0.179930
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings(X, cols, rows) 2.028319 1.997317 1.907001 1.956173 1.869994 1.623866
3 rowAnyMissings(X[cols, rows]) 3.261054 3.247604 3.156904 3.231316 3.085177 2.733460

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+100x1000 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+100x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 25.480 26.1915 27.23537 26.5800 27.1455 41.650
2 rowAnyMissings_X_S 30.262 30.9365 34.57757 31.9325 34.9330 65.825
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.00000 1.000000
2 rowAnyMissings_X_S 1.187677 1.181166 1.269583 1.201373 1.28688 1.580432

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

1000x100 matrix

> X <- data[["1000x100"]]
> rows <- sample.int(nrow(X), size = nrow(X) * 0.7)
> cols <- sample.int(ncol(X), size = ncol(X) * 0.7)
> X_S <- X[rows, cols]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066795 163.8    5709258 305.0  5709258 305.0
Vcells 5346398  40.8   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings_X_S = colAnyMissings(X_S), `colAnyMissings(X, rows, cols)` = colAnyMissings(X, 
+     rows = rows, cols = cols), `colAnyMissings(X[rows, cols])` = colAnyMissings(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3066789 163.8    5709258 305.0  5709258 305.0
Vcells 5446481  41.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings_X_S = rowAnyMissings(X_S), `rowAnyMissings(X, cols, rows)` = rowAnyMissings(X, 
+     rows = cols, cols = rows), `rowAnyMissings(X[cols, rows])` = rowAnyMissings(X[cols, rows]), unit = "ms")

Table: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 0.024417 0.0246915 0.0255219 0.0249735 0.025424 0.035591
2 colAnyMissings(X, rows, cols) 0.050943 0.0512200 0.0521011 0.0513790 0.051570 0.071666
3 colAnyMissings(X[rows, cols]) 0.092693 0.0938050 0.0970414 0.0947325 0.095963 0.208158
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAnyMissings(X, rows, cols) 2.086374 2.074398 2.041423 2.057341 2.028398 2.013599
3 colAnyMissings(X[rows, cols]) 3.796248 3.799081 3.802277 3.793321 3.774504 5.848613

Table: Benchmarking of rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on double+1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 rowAnyMissings_X_S 0.029110 0.029517 0.0301505 0.0297810 0.0302135 0.043248
2 rowAnyMissings(X, cols, rows) 0.064299 0.064734 0.0654624 0.0649210 0.0650860 0.096013
3 rowAnyMissings(X[cols, rows]) 0.103788 0.105128 0.1087878 0.1060125 0.1075830 0.258804
expr min lq mean median uq max
1 rowAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings(X, cols, rows) 2.208829 2.193109 2.171188 2.179947 2.154203 2.220056
3 rowAnyMissings(X[cols, rows]) 3.565373 3.561609 3.608157 3.559736 3.560759 5.984184

Figure: Benchmarking of colAnyMissings_X_S(), colAnyMissings(X, rows, cols)() and colAnyMissings(X[rows, cols])() on double+1000x100 data as well as rowAnyMissings_X_S(), rowAnyMissings(X, cols, rows)() and rowAnyMissings(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+1000x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.

expr min lq mean median uq max
1 colAnyMissings_X_S 24.417 24.6915 25.52193 24.9735 25.4240 35.591
2 rowAnyMissings_X_S 29.110 29.5170 30.15050 29.7810 30.2135 43.248
expr min lq mean median uq max
1 colAnyMissings_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAnyMissings_X_S 1.192202 1.195432 1.181357 1.192504 1.188385 1.215139

Figure: Benchmarking of colAnyMissings_X_S() and rowAnyMissings_X_S() on double+1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

Appendix

Session information

R version 3.6.1 Patched (2019-08-27 r77078)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /home/hb/software/R-devel/R-3-6-branch/lib/R/lib/libRblas.so
LAPACK: /home/hb/software/R-devel/R-3-6-branch/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] microbenchmark_1.4-6    matrixStats_0.55.0-9000 ggplot2_3.2.1          
[4] knitr_1.24              R.devices_2.16.0        R.utils_2.9.0          
[7] R.oo_1.22.0             R.methodsS3_1.7.1       history_0.0.0-9002     

loaded via a namespace (and not attached):
 [1] Biobase_2.45.0       bit64_0.9-7          splines_3.6.1       
 [4] network_1.15         assertthat_0.2.1     highr_0.8           
 [7] stats4_3.6.1         blob_1.2.0           robustbase_0.93-5   
[10] pillar_1.4.2         RSQLite_2.1.2        backports_1.1.4     
[13] lattice_0.20-38      glue_1.3.1           digest_0.6.20       
[16] colorspace_1.4-1     sandwich_2.5-1       Matrix_1.2-17       
[19] XML_3.98-1.20        lpSolve_5.6.13.3     pkgconfig_2.0.2     
[22] genefilter_1.66.0    purrr_0.3.2          ergm_3.10.4         
[25] xtable_1.8-4         mvtnorm_1.0-11       scales_1.0.0        
[28] tibble_2.1.3         annotate_1.62.0      IRanges_2.18.2      
[31] TH.data_1.0-10       withr_2.1.2          BiocGenerics_0.30.0 
[34] lazyeval_0.2.2       mime_0.7             survival_2.44-1.1   
[37] magrittr_1.5         crayon_1.3.4         statnet.common_4.3.0
[40] memoise_1.1.0        laeken_0.5.0         R.cache_0.13.0      
[43] MASS_7.3-51.4        R.rsp_0.43.1         tools_3.6.1         
[46] multcomp_1.4-10      S4Vectors_0.22.1     trust_0.1-7         
[49] munsell_0.5.0        AnnotationDbi_1.46.1 compiler_3.6.1      
[52] rlang_0.4.0          grid_3.6.1           RCurl_1.95-4.12     
[55] cwhmisc_6.6          rappdirs_0.3.1       labeling_0.3        
[58] bitops_1.0-6         base64enc_0.1-3      boot_1.3-23         
[61] gtable_0.3.0         codetools_0.2-16     DBI_1.0.0           
[64] markdown_1.1         R6_2.4.0             zoo_1.8-6           
[67] dplyr_0.8.3          bit_1.1-14           zeallot_0.1.0       
[70] parallel_3.6.1       Rcpp_1.0.2           vctrs_0.2.0         
[73] DEoptimR_1.0-8       tidyselect_0.2.5     xfun_0.9            
[76] coda_0.19-3         

Total processing time was 22.31 secs.

Reproducibility

To reproduce this report, do:

html <- matrixStats:::benchmark('colRowAnyMissings_subset')

Copyright Dongcan Jiang. Last updated on 2019-09-10 20:35:21 (-0700 UTC). Powered by RSP.

<script> var link = document.createElement('link'); link.rel = 'icon'; link.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA21BMVEUAAAAAAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8BAf4CAv0DA/wdHeIeHuEfH+AgIN8hId4lJdomJtknJ9g+PsE/P8BAQL9yco10dIt1dYp3d4h4eIeVlWqWlmmXl2iYmGeZmWabm2Tn5xjo6Bfp6Rb39wj4+Af//wA2M9hbAAAASXRSTlMAAQIJCgsMJSYnKD4/QGRlZmhpamtsbautrrCxuru8y8zN5ebn6Pn6+///////////////////////////////////////////LsUNcQAAAS9JREFUOI29k21XgkAQhVcFytdSMqMETU26UVqGmpaiFbL//xc1cAhhwVNf6n5i5z67M2dmYOyfJZUqlVLhkKucG7cgmUZTybDz6g0iDeq51PUr37Ds2cy2/C9NeES5puDjxuUk1xnToZsg8pfA3avHQ3lLIi7iWRrkv/OYtkScxBIMgDee0ALoyxHQBJ68JLCjOtQIMIANF7QG9G9fNnHvisCHBVMKgSJgiz7nE+AoBKrAPA3MgepvgR9TSCasrCKH0eB1wBGBFdCO+nAGjMVGPcQb5bd6mQRegN6+1axOs9nGfYcCtfi4NQosdtH7dB+txFIpXQqN1p9B/asRHToyS0jRgpV7nk4nwcq1BJ+x3Gl/v7S9Wmpp/aGquum7w3ZDyrADFYrl8vHBH+ev9AUASW1dmU4h4wAAAABJRU5ErkJggg==" document.getElementsByTagName('head')[0].appendChild(link); </script>
⚠️ **GitHub.com Fallback** ⚠️