colRowAlls_subset - HenrikBengtsson/matrixStats GitHub Wiki

matrixStats: Benchmark report


colAlls() and rowAlls() benchmarks on subsetted computation

This report benchmark the performance of colAlls() and rowAlls() on subsetted computation.

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 = "logical")

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 3059340 163.4    5709258 305.0  5709258 305.0
Vcells 5157201  39.4   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAlls_X_S = colAlls(X_S), `colAlls(X, rows, cols)` = colAlls(X, rows = rows, 
+     cols = cols), `colAlls(X[rows, cols])` = colAlls(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3058602 163.4    5709258 305.0  5709258 305.0
Vcells 5155247  39.4   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAlls_X_S = rowAlls(X_S), `rowAlls(X, cols, rows)` = rowAlls(X, rows = cols, 
+     cols = rows), `rowAlls(X[cols, rows])` = rowAlls(X[cols, rows]), unit = "ms")

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

expr min lq mean median uq max
1 colAlls_X_S 0.001408 0.0014320 0.0031280 0.0014625 0.0015420 0.163060
2 colAlls(X, rows, cols) 0.001590 0.0016440 0.0017440 0.0016685 0.0017460 0.004163
3 colAlls(X[rows, cols]) 0.002065 0.0021885 0.0025035 0.0023625 0.0024835 0.008878
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.0000000 1.000000 1.000000 1.0000000
2 colAlls(X, rows, cols) 1.129261 1.148045 0.5575551 1.140855 1.132296 0.0255305
3 colAlls(X[rows, cols]) 1.466619 1.528282 0.8003651 1.615385 1.610571 0.0544462

Table: Benchmarking of rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on 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 rowAlls_X_S 0.001262 0.0013075 0.0013901 0.001330 0.0013950 0.003398
2 rowAlls(X, cols, rows) 0.001455 0.0014985 0.0034254 0.001552 0.0017120 0.182386
3 rowAlls(X[cols, rows]) 0.001795 0.0019045 0.0021800 0.002065 0.0021765 0.007941
expr min lq mean median uq max
1 rowAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAlls(X, cols, rows) 1.152932 1.146080 2.464125 1.166917 1.227240 53.674514
3 rowAlls(X[cols, rows]) 1.422346 1.456597 1.568181 1.552632 1.560215 2.336963

Figure: Benchmarking of colAlls_X_S(), colAlls(X, rows, cols)() and colAlls(X[rows, cols])() on 10x10 data as well as rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 rowAlls_X_S 1.262 1.3075 1.39012 1.3300 1.395 3.398
1 colAlls_X_S 1.408 1.4320 3.12796 1.4625 1.542 163.060
expr min lq mean median uq max
2 rowAlls_X_S 1.000000 1.00000 1.000000 1.000000 1.000000 1.00000
1 colAlls_X_S 1.115689 1.09522 2.250137 1.099624 1.105376 47.98705

Figure: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 3058017 163.4    5709258 305.0  5709258 305.0
Vcells 5119555  39.1   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAlls_X_S = colAlls(X_S), `colAlls(X, rows, cols)` = colAlls(X, rows = rows, 
+     cols = cols), `colAlls(X[rows, cols])` = colAlls(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3058011 163.4    5709258 305.0  5709258 305.0
Vcells 5124638  39.1   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAlls_X_S = rowAlls(X_S), `rowAlls(X, cols, rows)` = rowAlls(X, rows = cols, 
+     cols = rows), `rowAlls(X[cols, rows])` = rowAlls(X[cols, rows]), unit = "ms")

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

expr min lq mean median uq max
1 colAlls_X_S 0.001944 0.0022095 0.0023710 0.0023175 0.0024495 0.004717
2 colAlls(X, rows, cols) 0.002419 0.0026585 0.0029568 0.0028195 0.0029815 0.010399
3 colAlls(X[rows, cols]) 0.017432 0.0177885 0.0183429 0.0179420 0.0181455 0.041368
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAlls(X, rows, cols) 1.244342 1.203213 1.247075 1.216613 1.217187 2.204579
3 colAlls(X[rows, cols]) 8.967078 8.050916 7.736413 7.741963 7.407838 8.769981

Table: Benchmarking of rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on 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 rowAlls_X_S 0.003000 0.0033290 0.0035083 0.0034460 0.0035930 0.006415
2 rowAlls(X, cols, rows) 0.003421 0.0037425 0.0039460 0.0038795 0.0039750 0.007173
3 rowAlls(X[cols, rows]) 0.010020 0.0104265 0.0110952 0.0106155 0.0107805 0.041441
expr min lq mean median uq max
1 rowAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAlls(X, cols, rows) 1.140333 1.124211 1.124776 1.125798 1.106318 1.118161
3 rowAlls(X[cols, rows]) 3.340000 3.132022 3.162587 3.080528 3.000418 6.460016

Figure: Benchmarking of colAlls_X_S(), colAlls(X, rows, cols)() and colAlls(X[rows, cols])() on 100x100 data as well as rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 colAlls_X_S 1.944 2.2095 2.37098 2.3175 2.4495 4.717
2 rowAlls_X_S 3.000 3.3290 3.50828 3.4460 3.5930 6.415
expr min lq mean median uq max
1 colAlls_X_S 1.00000 1.000000 1.000000 1.000000 1.00000 1.000000
2 rowAlls_X_S 1.54321 1.506676 1.479675 1.486947 1.46683 1.359975

Figure: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 3058771 163.4    5709258 305.0  5709258 305.0
Vcells 5123628  39.1   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAlls_X_S = colAlls(X_S), `colAlls(X, rows, cols)` = colAlls(X, rows = rows, 
+     cols = cols), `colAlls(X[rows, cols])` = colAlls(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3058762 163.4    5709258 305.0  5709258 305.0
Vcells 5128706  39.2   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAlls_X_S = rowAlls(X_S), `rowAlls(X, cols, rows)` = rowAlls(X, rows = cols, 
+     cols = rows), `rowAlls(X[cols, rows])` = rowAlls(X[cols, rows]), unit = "ms")

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

expr min lq mean median uq max
1 colAlls_X_S 0.001351 0.001427 0.0015849 0.0015085 0.0016505 0.005117
2 colAlls(X, rows, cols) 0.002145 0.002229 0.0026838 0.0023415 0.0024660 0.034505
3 colAlls(X[rows, cols]) 0.016284 0.016699 0.0171418 0.0168145 0.0170015 0.030637
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAlls(X, rows, cols) 1.587713 1.562018 1.693337 1.552204 1.494093 6.743209
3 colAlls(X[rows, cols]) 12.053294 11.702172 10.815667 11.146503 10.300818 5.987297

Table: Benchmarking of rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on 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 rowAlls_X_S 0.006176 0.0062465 0.0069544 0.0063220 0.0064580 0.040551
2 rowAlls(X, cols, rows) 0.007471 0.0075660 0.0080869 0.0077225 0.0079595 0.015814
3 rowAlls(X[cols, rows]) 0.017889 0.0181085 0.0194976 0.0182985 0.0185370 0.040142
expr min lq mean median uq max
1 rowAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAlls(X, cols, rows) 1.209683 1.211238 1.162838 1.221528 1.232502 0.3899781
3 rowAlls(X[cols, rows]) 2.896535 2.898983 2.803612 2.894416 2.870393 0.9899139

Figure: Benchmarking of colAlls_X_S(), colAlls(X, rows, cols)() and colAlls(X[rows, cols])() on 1000x10 data as well as rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 colAlls_X_S 1.351 1.4270 1.58490 1.5085 1.6505 5.117
2 rowAlls_X_S 6.176 6.2465 6.95445 6.3220 6.4580 40.551
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAlls_X_S 4.571429 4.377365 4.387943 4.190918 3.912754 7.924761

Figure: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 3058974 163.4    5709258 305.0  5709258 305.0
Vcells 5124429  39.1   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAlls_X_S = colAlls(X_S), `colAlls(X, rows, cols)` = colAlls(X, rows = rows, 
+     cols = cols), `colAlls(X[rows, cols])` = colAlls(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3058968 163.4    5709258 305.0  5709258 305.0
Vcells 5129512  39.2   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAlls_X_S = rowAlls(X_S), `rowAlls(X, cols, rows)` = rowAlls(X, rows = cols, 
+     cols = rows), `rowAlls(X[cols, rows])` = rowAlls(X[cols, rows]), unit = "ms")

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

expr min lq mean median uq max
1 colAlls_X_S 0.004488 0.0047875 0.0052068 0.0050045 0.005300 0.011778
2 colAlls(X, rows, cols) 0.008280 0.0092255 0.0099900 0.0094240 0.009714 0.052993
3 colAlls(X[rows, cols]) 0.013296 0.0135805 0.0142384 0.0139020 0.014359 0.023996
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAlls(X, rows, cols) 1.844920 1.926997 1.918671 1.883105 1.832830 4.499321
3 colAlls(X[rows, cols]) 2.962567 2.836658 2.734614 2.777900 2.709245 2.037358

Table: Benchmarking of rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on 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 rowAlls_X_S 0.005664 0.0067125 0.0077411 0.0071900 0.0076575 0.045072
2 rowAlls(X, cols, rows) 0.008594 0.0101785 0.0110121 0.0108175 0.0114600 0.018645
3 rowAlls(X[cols, rows]) 0.013025 0.0142005 0.0150228 0.0146910 0.0151995 0.034543
expr min lq mean median uq max
1 rowAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAlls(X, cols, rows) 1.517302 1.516350 1.422537 1.504520 1.496572 0.4136715
3 rowAlls(X[cols, rows]) 2.299612 2.115531 1.940642 2.043255 1.984917 0.7663960

Figure: Benchmarking of colAlls_X_S(), colAlls(X, rows, cols)() and colAlls(X[rows, cols])() on 10x1000 data as well as rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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
1 colAlls_X_S 4.488 4.7875 5.20675 5.0045 5.3000 11.778
2 rowAlls_X_S 5.664 6.7125 7.74114 7.1900 7.6575 45.072
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAlls_X_S 1.262032 1.402089 1.486751 1.436707 1.444811 3.826796

Figure: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 3059173 163.4    5709258 305.0  5709258 305.0
Vcells 5147073  39.3   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAlls_X_S = colAlls(X_S), `colAlls(X, rows, cols)` = colAlls(X, rows = rows, 
+     cols = cols), `colAlls(X[rows, cols])` = colAlls(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3059167 163.4    5709258 305.0  5709258 305.0
Vcells 5197156  39.7   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAlls_X_S = rowAlls(X_S), `rowAlls(X, cols, rows)` = rowAlls(X, rows = cols, 
+     cols = rows), `rowAlls(X[cols, rows])` = rowAlls(X[cols, rows]), unit = "ms")

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

expr min lq mean median uq max
1 colAlls_X_S 0.005554 0.0064470 0.0070582 0.0069275 0.0072755 0.019822
2 colAlls(X, rows, cols) 0.010863 0.0120410 0.0130683 0.0124000 0.0128140 0.072151
3 colAlls(X[rows, cols]) 0.153107 0.1540355 0.1553696 0.1545630 0.1552315 0.197734
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.00000 1.000000 1.000000 1.000000 1.000000
2 colAlls(X, rows, cols) 1.955888 1.86769 1.851496 1.789967 1.761254 3.639946
3 colAlls(X[rows, cols]) 27.566979 23.89259 22.012482 22.311512 21.336197 9.975482

Table: Benchmarking of rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on 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 rowAlls_X_S 0.018842 0.0206950 0.0222333 0.0215225 0.0222730 0.060481
2 rowAlls(X, cols, rows) 0.022701 0.0249305 0.0277703 0.0260480 0.0273615 0.047461
3 rowAlls(X[cols, rows]) 0.082743 0.0847925 0.0890761 0.0855490 0.0864580 0.159622
expr min lq mean median uq max
1 rowAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.00000 1.0000000
2 rowAlls(X, cols, rows) 1.204808 1.204663 1.249040 1.210268 1.22846 0.7847258
3 rowAlls(X[cols, rows]) 4.391413 4.097246 4.006425 3.974864 3.88174 2.6392090

Figure: Benchmarking of colAlls_X_S(), colAlls(X, rows, cols)() and colAlls(X[rows, cols])() on 100x1000 data as well as rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 colAlls_X_S 5.554 6.447 7.05825 6.9275 7.2755 19.822
2 rowAlls_X_S 18.842 20.695 22.23330 21.5225 22.2730 60.481
expr min lq mean median uq max
1 colAlls_X_S 1.00000 1.00000 1.000000 1.000000 1.00000 1.000000
2 rowAlls_X_S 3.39251 3.21002 3.149973 3.106821 3.06137 3.051206

Figure: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 3059389 163.4    5709258 305.0  5709258 305.0
Vcells 5147739  39.3   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAlls_X_S = colAlls(X_S), `colAlls(X, rows, cols)` = colAlls(X, rows = rows, 
+     cols = cols), `colAlls(X[rows, cols])` = colAlls(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3059383 163.4    5709258 305.0  5709258 305.0
Vcells 5197822  39.7   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAlls_X_S = rowAlls(X_S), `rowAlls(X, cols, rows)` = rowAlls(X, rows = cols, 
+     cols = rows), `rowAlls(X[cols, rows])` = rowAlls(X[cols, rows]), unit = "ms")

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

expr min lq mean median uq max
1 colAlls_X_S 0.001920 0.0023075 0.0025936 0.0024830 0.0027075 0.006253
2 colAlls(X, rows, cols) 0.002877 0.0032770 0.0036432 0.0034865 0.0037040 0.008226
3 colAlls(X[rows, cols]) 0.065247 0.0659110 0.0675744 0.0661680 0.0665560 0.144712
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 colAlls(X, rows, cols) 1.498438 1.420152 1.404687 1.404148 1.368052 1.315529
3 colAlls(X[rows, cols]) 33.982813 28.563814 26.054191 26.648409 24.582087 23.142812

Table: Benchmarking of rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on 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 rowAlls_X_S 0.015859 0.0161130 0.0164732 0.0163055 0.0164835 0.031029
2 rowAlls(X, cols, rows) 0.016869 0.0172705 0.0178412 0.0174245 0.0176640 0.029128
3 rowAlls(X[cols, rows]) 0.082111 0.0826030 0.0838155 0.0828220 0.0831350 0.162462
expr min lq mean median uq max
1 rowAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.0000000
2 rowAlls(X, cols, rows) 1.063686 1.071836 1.083047 1.068627 1.071617 0.9387347
3 rowAlls(X[cols, rows]) 5.177565 5.126482 5.088002 5.079390 5.043528 5.2358117

Figure: Benchmarking of colAlls_X_S(), colAlls(X, rows, cols)() and colAlls(X[rows, cols])() on 1000x100 data as well as rowAlls_X_S(), rowAlls(X, cols, rows)() and rowAlls(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

Table: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 colAlls_X_S 1.920 2.3075 2.59361 2.4830 2.7075 6.253
2 rowAlls_X_S 15.859 16.1130 16.47317 16.3055 16.4835 31.029
expr min lq mean median uq max
1 colAlls_X_S 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2 rowAlls_X_S 8.259896 6.982882 6.351445 6.566855 6.088089 4.962258

Figure: Benchmarking of colAlls_X_S() and rowAlls_X_S() on 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 10.84 secs.

Reproducibility

To reproduce this report, do:

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

Copyright Dongcan Jiang. Last updated on 2019-09-10 20:34:45 (-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** ⚠️