-
Notifications
You must be signed in to change notification settings - Fork 34
colRowAnys
matrixStats: Benchmark report
This report benchmark the performance of colAnys() and rowAnys() against alternative methods.
- apply() + any()
- colSums() > 0 or rowSums() > 0
> 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")
> X <- data[["10x10"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3076924 164.4 5709258 305.0 5709258 305.0
Vcells 5446537 41.6 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnys = colAnys(X), `apply+any` = apply(X, MARGIN = 2L, FUN = any),
+ `colSums > 0` = (colSums(X) > 0L), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075852 164.3 5709258 305.0 5709258 305.0
Vcells 5443727 41.6 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnys = rowAnys(X), `apply+any` = apply(X, MARGIN = 1L, FUN = any),
+ `rowSums > 0` = (rowSums(X) > 0L), unit = "ms")
Table: Benchmarking of colAnys(), apply+any() and colSums > 0() 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 | colAnys | 0.001409 | 0.0016820 | 0.0021317 | 0.0020960 | 0.0022740 | 0.014822 |
3 | colSums > 0 | 0.003203 | 0.0035375 | 0.0045709 | 0.0040560 | 0.0046105 | 0.050292 |
2 | apply+any | 0.018943 | 0.0198790 | 0.0211223 | 0.0202665 | 0.0206385 | 0.096390 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | colSums > 0 | 2.273243 | 2.103151 | 2.144281 | 1.935115 | 2.027485 | 3.393064 |
2 | apply+any | 13.444287 | 11.818668 | 9.908818 | 9.669132 | 9.075857 | 6.503171 |
Table: Benchmarking of rowAnys(), apply+any() and rowSums > 0() 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 | rowAnys | 0.001352 | 0.001613 | 0.0020306 | 0.0019925 | 0.0021370 | 0.014867 |
3 | rowSums > 0 | 0.003700 | 0.004049 | 0.0048250 | 0.0044065 | 0.0047855 | 0.042995 |
2 | apply+any | 0.018271 | 0.019153 | 0.0201576 | 0.0196070 | 0.0200150 | 0.066538 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums > 0 | 2.736686 | 2.510229 | 2.376183 | 2.211543 | 2.239354 | 2.891976 |
2 | apply+any | 13.514053 | 11.874148 | 9.927041 | 9.840402 | 9.365934 | 4.475550 |
Figure: Benchmarking of colAnys(), apply+any() and colSums > 0() on 10x10 data as well as rowAnys(), apply+any() and rowSums > 0() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colAnys() and rowAnys() 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 | rowAnys | 1.352 | 1.613 | 2.03058 | 1.9925 | 2.137 | 14.867 |
1 | colAnys | 1.409 | 1.682 | 2.13167 | 2.0960 | 2.274 | 14.822 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowAnys | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
1 | colAnys | 1.04216 | 1.042777 | 1.049784 | 1.051945 | 1.064109 | 0.9969732 |
Figure: Benchmarking of colAnys() and rowAnys() on 10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> X <- data[["100x100"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3074405 164.2 5709258 305.0 5709258 305.0
Vcells 5249923 40.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnys = colAnys(X), `apply+any` = apply(X, MARGIN = 2L, FUN = any),
+ `colSums > 0` = (colSums(X) > 0L), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3074399 164.2 5709258 305.0 5709258 305.0
Vcells 5254966 40.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnys = rowAnys(X), `apply+any` = apply(X, MARGIN = 1L, FUN = any),
+ `rowSums > 0` = (rowSums(X) > 0L), unit = "ms")
Table: Benchmarking of colAnys(), apply+any() and colSums > 0() 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 | colAnys | 0.001983 | 0.0026210 | 0.0032875 | 0.0030400 | 0.003373 | 0.017689 |
3 | colSums > 0 | 0.012002 | 0.0128435 | 0.0136077 | 0.0135200 | 0.013936 | 0.027762 |
2 | apply+any | 0.170574 | 0.1759735 | 0.1829443 | 0.1804605 | 0.186364 | 0.307078 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
3 | colSums > 0 | 6.052446 | 4.900229 | 4.139171 | 4.447368 | 4.131634 | 1.56945 |
2 | apply+any | 86.018154 | 67.139832 | 55.647767 | 59.362007 | 55.251705 | 17.35983 |
Table: Benchmarking of rowAnys(), apply+any() and rowSums > 0() 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 | rowAnys | 0.007374 | 0.007807 | 0.0090621 | 0.0084775 | 0.0089945 | 0.031446 |
3 | rowSums > 0 | 0.034992 | 0.035657 | 0.0379811 | 0.0365035 | 0.0373175 | 0.072237 |
2 | apply+any | 0.128059 | 0.130017 | 0.1448516 | 0.1337435 | 0.1387050 | 0.421439 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums > 0 | 4.745321 | 4.567311 | 4.191221 | 4.305928 | 4.148924 | 2.297176 |
2 | apply+any | 17.366287 | 16.653900 | 15.984387 | 15.776290 | 15.421091 | 13.401991 |
Figure: Benchmarking of colAnys(), apply+any() and colSums > 0() on 100x100 data as well as rowAnys(), apply+any() and rowSums > 0() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colAnys() and rowAnys() 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 | colAnys | 1.983 | 2.621 | 3.28754 | 3.0400 | 3.3730 | 17.689 |
2 | rowAnys | 7.374 | 7.807 | 9.06207 | 8.4775 | 8.9945 | 31.446 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowAnys | 3.718608 | 2.978634 | 2.75649 | 2.788651 | 2.666617 | 1.777715 |
Figure: Benchmarking of colAnys() and rowAnys() on 100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> X <- data[["1000x10"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075160 164.3 5709258 305.0 5709258 305.0
Vcells 5253453 40.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnys = colAnys(X), `apply+any` = apply(X, MARGIN = 2L, FUN = any),
+ `colSums > 0` = (colSums(X) > 0L), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075151 164.3 5709258 305.0 5709258 305.0
Vcells 5258491 40.2 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnys = rowAnys(X), `apply+any` = apply(X, MARGIN = 1L, FUN = any),
+ `rowSums > 0` = (rowSums(X) > 0L), unit = "ms")
Table: Benchmarking of colAnys(), apply+any() and colSums > 0() 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 | colAnys | 0.001420 | 0.0018105 | 0.0022909 | 0.0022640 | 0.0025450 | 0.013141 |
3 | colSums > 0 | 0.011362 | 0.0117590 | 0.0125820 | 0.0125435 | 0.0131395 | 0.025477 |
2 | apply+any | 0.106342 | 0.1074235 | 0.1102312 | 0.1085720 | 0.1107750 | 0.196663 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | colSums > 0 | 8.001409 | 6.494891 | 5.492084 | 5.540415 | 5.162868 | 1.938741 |
2 | apply+any | 74.888732 | 59.333610 | 48.116372 | 47.955830 | 43.526523 | 14.965604 |
Table: Benchmarking of rowAnys(), apply+any() and rowSums > 0() 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 | rowAnys | 0.007637 | 0.008313 | 0.0089298 | 0.008670 | 0.0090945 | 0.033725 |
2 | apply+any | 0.062229 | 0.064914 | 0.0665394 | 0.065440 | 0.0662155 | 0.121197 |
3 | rowSums > 0 | 0.133206 | 0.133676 | 0.1345420 | 0.134236 | 0.1345585 | 0.157303 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | apply+any | 8.148357 | 7.808733 | 7.451395 | 7.547866 | 7.280829 | 3.593684 |
3 | rowSums > 0 | 17.442189 | 16.080356 | 15.066651 | 15.482814 | 14.795591 | 4.664285 |
Figure: Benchmarking of colAnys(), apply+any() and colSums > 0() on 1000x10 data as well as rowAnys(), apply+any() and rowSums > 0() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colAnys() and rowAnys() 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 | colAnys | 1.420 | 1.8105 | 2.29093 | 2.264 | 2.5450 | 13.141 |
2 | rowAnys | 7.637 | 8.3130 | 8.92979 | 8.670 | 9.0945 | 33.725 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowAnys | 5.378169 | 4.591549 | 3.897889 | 3.829505 | 3.573477 | 2.566395 |
Figure: Benchmarking of colAnys() and rowAnys() on 1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> X <- data[["10x1000"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075362 164.3 5709258 305.0 5709258 305.0
Vcells 5254179 40.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnys = colAnys(X), `apply+any` = apply(X, MARGIN = 2L, FUN = any),
+ `colSums > 0` = (colSums(X) > 0L), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075356 164.3 5709258 305.0 5709258 305.0
Vcells 5259222 40.2 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnys = rowAnys(X), `apply+any` = apply(X, MARGIN = 1L, FUN = any),
+ `rowSums > 0` = (rowSums(X) > 0L), unit = "ms")
Table: Benchmarking of colAnys(), apply+any() and colSums > 0() 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 | colAnys | 0.007631 | 0.0084180 | 0.0103535 | 0.0094965 | 0.0109950 | 0.024751 |
3 | colSums > 0 | 0.013443 | 0.0160035 | 0.0178000 | 0.0169520 | 0.0179195 | 0.052343 |
2 | apply+any | 0.748316 | 0.8504210 | 0.8765576 | 0.8680990 | 0.9004565 | 1.336996 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | colSums > 0 | 1.76163 | 1.901105 | 1.719221 | 1.785079 | 1.629786 | 2.114783 |
2 | apply+any | 98.06264 | 101.024115 | 84.662926 | 91.412520 | 81.896908 | 54.017858 |
Table: Benchmarking of rowAnys(), apply+any() and rowSums > 0() 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 | rowAnys | 0.019140 | 0.0215825 | 0.0228858 | 0.0227170 | 0.0238075 | 0.035336 |
3 | rowSums > 0 | 0.028248 | 0.0306170 | 0.0329904 | 0.0321730 | 0.0332045 | 0.076977 |
2 | apply+any | 0.749158 | 0.8338955 | 0.8688107 | 0.8689875 | 0.8818345 | 1.748149 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
3 | rowSums > 0 | 1.475862 | 1.418603 | 1.441523 | 1.416252 | 1.394708 | 2.17843 |
2 | apply+any | 39.140961 | 38.637577 | 37.962857 | 38.252740 | 37.040197 | 49.47218 |
Figure: Benchmarking of colAnys(), apply+any() and colSums > 0() on 10x1000 data as well as rowAnys(), apply+any() and rowSums > 0() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colAnys() and rowAnys() 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 | colAnys | 7.631 | 8.4180 | 10.35350 | 9.4965 | 10.9950 | 24.751 |
2 | rowAnys | 19.140 | 21.5825 | 22.88581 | 22.7170 | 23.8075 | 35.336 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | rowAnys | 2.50819 | 2.563851 | 2.210442 | 2.392145 | 2.165302 | 1.42766 |
Figure: Benchmarking of colAnys() and rowAnys() on 10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> X <- data[["100x1000"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075581 164.3 5709258 305.0 5709258 305.0
Vcells 5254705 40.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnys = colAnys(X), `apply+any` = apply(X, MARGIN = 2L, FUN = any),
+ `colSums > 0` = (colSums(X) > 0L), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075569 164.3 5709258 305.0 5709258 305.0
Vcells 5304738 40.5 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnys = rowAnys(X), `apply+any` = apply(X, MARGIN = 1L, FUN = any),
+ `rowSums > 0` = (rowSums(X) > 0L), unit = "ms")
Table: Benchmarking of colAnys(), apply+any() and colSums > 0() 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 | colAnys | 0.008099 | 0.0095220 | 0.0119732 | 0.0109315 | 0.012789 | 0.053653 |
3 | colSums > 0 | 0.083496 | 0.0957385 | 0.0971840 | 0.0972690 | 0.099108 | 0.114800 |
2 | apply+any | 1.600610 | 1.7995685 | 1.8141498 | 1.8099180 | 1.835619 | 2.166671 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.00000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | colSums > 0 | 10.30942 | 10.05445 | 8.116831 | 8.898047 | 7.749472 | 2.139675 |
2 | apply+any | 197.63057 | 188.99060 | 151.518174 | 165.569044 | 143.531081 | 40.383035 |
Table: Benchmarking of rowAnys(), apply+any() and rowSums > 0() 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 | rowAnys | 0.067779 | 0.0746215 | 0.076382 | 0.0762285 | 0.0778680 | 0.092209 |
3 | rowSums > 0 | 0.223956 | 0.2489675 | 0.252571 | 0.2565880 | 0.2580455 | 0.288709 |
2 | apply+any | 1.191257 | 1.2977970 | 1.325457 | 1.3312255 | 1.3451045 | 1.534203 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums > 0 | 3.304209 | 3.336404 | 3.306683 | 3.366038 | 3.313884 | 3.131028 |
2 | apply+any | 17.575606 | 17.391730 | 17.353005 | 17.463619 | 17.274163 | 16.638322 |
Figure: Benchmarking of colAnys(), apply+any() and colSums > 0() on 100x1000 data as well as rowAnys(), apply+any() and rowSums > 0() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colAnys() and rowAnys() 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 | colAnys | 8.099 | 9.5220 | 11.97315 | 10.9315 | 12.789 | 53.653 |
2 | rowAnys | 67.779 | 74.6215 | 76.38199 | 76.2285 | 77.868 | 92.209 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.00000 | 1.000000 |
2 | rowAnys | 8.368811 | 7.836747 | 6.37944 | 6.973288 | 6.08867 | 1.718618 |
Figure: Benchmarking of colAnys() and rowAnys() on 100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> X <- data[["1000x100"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075793 164.3 5709258 305.0 5709258 305.0
Vcells 5255375 40.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnys = colAnys(X), `apply+any` = apply(X, MARGIN = 2L, FUN = any),
+ `colSums > 0` = (colSums(X) > 0L), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3075781 164.3 5709258 305.0 5709258 305.0
Vcells 5305408 40.5 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnys = rowAnys(X), `apply+any` = apply(X, MARGIN = 1L, FUN = any),
+ `rowSums > 0` = (rowSums(X) > 0L), unit = "ms")
Table: Benchmarking of colAnys(), apply+any() and colSums > 0() 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 | colAnys | 0.002520 | 0.0032355 | 0.0041383 | 0.003961 | 0.0044305 | 0.016411 |
3 | colSums > 0 | 0.081511 | 0.0889975 | 0.0919926 | 0.091922 | 0.0958630 | 0.108950 |
2 | apply+any | 0.512329 | 0.5432960 | 0.5562859 | 0.555951 | 0.5703010 | 0.645138 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 |
3 | colSums > 0 | 32.34563 | 27.50657 | 22.22972 | 23.20677 | 21.63706 | 6.63884 |
2 | apply+any | 203.30516 | 167.91717 | 134.42474 | 140.35622 | 128.72159 | 39.31132 |
Table: Benchmarking of rowAnys(), apply+any() and rowSums > 0() 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 | rowAnys | 0.057554 | 0.0643550 | 0.0661932 | 0.0663185 | 0.0676865 | 0.114304 |
3 | rowSums > 0 | 0.314876 | 0.3501235 | 0.3556642 | 0.3596680 | 0.3608840 | 0.409574 |
2 | apply+any | 0.546965 | 0.5674115 | 0.5772502 | 0.5720150 | 0.5803790 | 0.685904 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAnys | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums > 0 | 5.470966 | 5.440502 | 5.373123 | 5.423343 | 5.331698 | 3.583199 |
2 | apply+any | 9.503510 | 8.816899 | 8.720688 | 8.625270 | 8.574516 | 6.000700 |
Figure: Benchmarking of colAnys(), apply+any() and colSums > 0() on 1000x100 data as well as rowAnys(), apply+any() and rowSums > 0() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colAnys() and rowAnys() 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 | colAnys | 2.520 | 3.2355 | 4.13827 | 3.9610 | 4.4305 | 16.411 |
2 | rowAnys | 57.554 | 64.3550 | 66.19320 | 66.3185 | 67.6865 | 114.304 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAnys | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.0000 | 1.000000 |
2 | rowAnys | 22.83889 | 19.89028 | 15.99538 | 16.74287 | 15.2774 | 6.965084 |
Figure: Benchmarking of colAnys() and rowAnys() on 1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
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 11.72 secs.
To reproduce this report, do:
html <- matrixStats:::benchmark('colAnys')
Copyright Henrik Bengtsson. Last updated on 2019-09-10 20:36:12 (-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>