-
Notifications
You must be signed in to change notification settings - Fork 34
colRowAlls
matrixStats: Benchmark report
This report benchmark the performance of colAlls() and rowAlls() against alternative methods.
- apply() + all()
- colSums() == n or rowSums() == n
> 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 1536119 82.1 2637877 140.9 2637877 140.9
Vcells 2374583 18.2 5986528 45.7 55745682 425.4
> colStats <- microbenchmark(colAlls = colAlls(X), `apply+all` = apply(X, MARGIN = 2L, FUN = all),
+ `colSums==n` = (colSums(X) == nrow(X)), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1534953 82.0 2637877 140.9 2637877 140.9
Vcells 2372458 18.2 5986528 45.7 55745682 425.4
> rowStats <- microbenchmark(rowAlls = rowAlls(X), `apply+all` = apply(X, MARGIN = 1L, FUN = all),
+ `rowSums==n` = (rowSums(X) == ncol(X)), unit = "ms")
Table: Benchmarking of colAlls(), apply+all() and colSums==n() 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 | 0.001720 | 0.0020315 | 0.0044374 | 0.0024620 | 0.0026955 | 0.205407 |
3 | colSums==n | 0.004736 | 0.0052460 | 0.0063776 | 0.0058445 | 0.0064355 | 0.054051 |
2 | apply+all | 0.023673 | 0.0246595 | 0.0262043 | 0.0252490 | 0.0260795 | 0.066520 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
3 | colSums==n | 2.753488 | 2.582328 | 1.437231 | 2.373883 | 2.387498 | 0.2631410 |
2 | apply+all | 13.763372 | 12.138568 | 5.905263 | 10.255483 | 9.675199 | 0.3238449 |
Table: Benchmarking of rowAlls(), apply+all() and rowSums==n() 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 | 0.001773 | 0.0020335 | 0.0044965 | 0.0024075 | 0.0026205 | 0.214778 |
3 | rowSums==n | 0.004336 | 0.0048310 | 0.0057944 | 0.0052810 | 0.0058210 | 0.033994 |
2 | apply+all | 0.023206 | 0.0243505 | 0.0256536 | 0.0250425 | 0.0256620 | 0.062862 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
3 | rowSums==n | 2.445572 | 2.375707 | 1.288661 | 2.193562 | 2.221332 | 0.1582751 |
2 | apply+all | 13.088551 | 11.974674 | 5.705258 | 10.401869 | 9.792788 | 0.2926836 |
Figure: Benchmarking of colAlls(), apply+all() and colSums==n() on 10x10 data as well as rowAlls(), apply+all() and rowSums==n() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colAlls() and rowAlls() 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 | 1.773 | 2.0335 | 4.49648 | 2.4075 | 2.6205 | 214.778 |
1 | colAlls | 1.720 | 2.0315 | 4.43745 | 2.4620 | 2.6955 | 205.407 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowAlls | 1.0000000 | 1.0000000 | 1.000000 | 1.000000 | 1.00000 | 1.0000000 |
1 | colAlls | 0.9701072 | 0.9990165 | 0.986872 | 1.022638 | 1.02862 | 0.9563689 |
Figure: Benchmarking of colAlls() and rowAlls() 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 1534703 82.0 2637877 140.9 2637877 140.9
Vcells 2139126 16.4 5986528 45.7 55745682 425.4
> colStats <- microbenchmark(colAlls = colAlls(X), `apply+all` = apply(X, MARGIN = 2L, FUN = all),
+ `colSums==n` = (colSums(X) == nrow(X)), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1534697 82.0 2637877 140.9 2637877 140.9
Vcells 2144169 16.4 5986528 45.7 55745682 425.4
> rowStats <- microbenchmark(rowAlls = rowAlls(X), `apply+all` = apply(X, MARGIN = 1L, FUN = all),
+ `rowSums==n` = (rowSums(X) == ncol(X)), unit = "ms")
Table: Benchmarking of colAlls(), apply+all() and colSums==n() 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 | 0.002636 | 0.0031315 | 0.0037904 | 0.0037945 | 0.0041760 | 0.013224 |
3 | colSums==n | 0.015105 | 0.0163255 | 0.0174746 | 0.0171295 | 0.0178225 | 0.043113 |
2 | apply+all | 0.186309 | 0.1945085 | 0.2001144 | 0.1973185 | 0.2011820 | 0.285261 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 | 1.000000 |
3 | colSums==n | 5.730273 | 5.213316 | 4.610238 | 4.514297 | 4.26784 | 3.260209 |
2 | apply+all | 70.678680 | 62.113524 | 52.795195 | 52.001186 | 48.17577 | 21.571461 |
Table: Benchmarking of rowAlls(), apply+all() and rowSums==n() 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 | 0.008252 | 0.0089090 | 0.0095079 | 0.0093445 | 0.0096925 | 0.020623 |
3 | rowSums==n | 0.034393 | 0.0359225 | 0.0370284 | 0.0369885 | 0.0373710 | 0.048771 |
2 | apply+all | 0.185038 | 0.1923415 | 0.1998491 | 0.1964000 | 0.2026280 | 0.301966 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums==n | 4.167838 | 4.032159 | 3.894476 | 3.958318 | 3.855662 | 2.364884 |
2 | apply+all | 22.423413 | 21.589572 | 21.019226 | 21.017711 | 20.905649 | 14.642196 |
Figure: Benchmarking of colAlls(), apply+all() and colSums==n() on 100x100 data as well as rowAlls(), apply+all() and rowSums==n() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colAlls() and rowAlls() 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 | 2.636 | 3.1315 | 3.79039 | 3.7945 | 4.1760 | 13.224 |
2 | rowAlls | 8.252 | 8.9090 | 9.50792 | 9.3445 | 9.6925 | 20.623 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowAlls | 3.130501 | 2.844962 | 2.508428 | 2.462643 | 2.321001 | 1.559513 |
Figure: Benchmarking of colAlls() and rowAlls() 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 1536101 82.1 2637877 140.9 2637877 140.9
Vcells 2143024 16.4 5986528 45.7 55745682 425.4
> colStats <- microbenchmark(colAlls = colAlls(X), `apply+all` = apply(X, MARGIN = 2L, FUN = all),
+ `colSums==n` = (colSums(X) == nrow(X)), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1536095 82.1 2637877 140.9 2637877 140.9
Vcells 2148067 16.4 5986528 45.7 55745682 425.4
> rowStats <- microbenchmark(rowAlls = rowAlls(X), `apply+all` = apply(X, MARGIN = 1L, FUN = all),
+ `rowSums==n` = (rowSums(X) == ncol(X)), unit = "ms")
Table: Benchmarking of colAlls(), apply+all() and colSums==n() 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 | 0.001651 | 0.0019695 | 0.0026153 | 0.0025975 | 0.0028445 | 0.013843 |
3 | colSums==n | 0.015934 | 0.0164495 | 0.0174766 | 0.0173985 | 0.0178750 | 0.031607 |
2 | apply+all | 0.104468 | 0.1072815 | 0.1112322 | 0.1090035 | 0.1120520 | 0.175632 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.00000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | colSums==n | 9.65112 | 8.35212 | 6.682328 | 6.698171 | 6.284057 | 2.283248 |
2 | apply+all | 63.27559 | 54.47144 | 42.530665 | 41.964774 | 39.392512 | 12.687423 |
Table: Benchmarking of rowAlls(), apply+all() and rowSums==n() 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 | 0.007292 | 0.0084570 | 0.0089494 | 0.0088990 | 0.0092060 | 0.017525 |
3 | rowSums==n | 0.035133 | 0.0358775 | 0.0371603 | 0.0367395 | 0.0381025 | 0.047463 |
2 | apply+all | 0.104138 | 0.1066025 | 0.1110490 | 0.1088720 | 0.1129890 | 0.175570 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAlls | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums==n | 4.81802 | 4.242344 | 4.152261 | 4.128498 | 4.138877 | 2.708302 |
2 | apply+all | 14.28113 | 12.605238 | 12.408511 | 12.234184 | 12.273409 | 10.018260 |
Figure: Benchmarking of colAlls(), apply+all() and colSums==n() on 1000x10 data as well as rowAlls(), apply+all() and rowSums==n() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colAlls() and rowAlls() 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 | 1.651 | 1.9695 | 2.61534 | 2.5975 | 2.8445 | 13.843 |
2 | rowAlls | 7.292 | 8.4570 | 8.94942 | 8.8990 | 9.2060 | 17.525 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowAlls | 4.416717 | 4.293983 | 3.421895 | 3.425987 | 3.236421 | 1.265983 |
Figure: Benchmarking of colAlls() and rowAlls() 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 1536201 82.1 2637877 140.9 2637877 140.9
Vcells 2143684 16.4 5986528 45.7 55745682 425.4
> colStats <- microbenchmark(colAlls = colAlls(X), `apply+all` = apply(X, MARGIN = 2L, FUN = all),
+ `colSums==n` = (colSums(X) == nrow(X)), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1536195 82.1 2637877 140.9 2637877 140.9
Vcells 2148727 16.4 5986528 45.7 55745682 425.4
> rowStats <- microbenchmark(rowAlls = rowAlls(X), `apply+all` = apply(X, MARGIN = 1L, FUN = all),
+ `rowSums==n` = (rowSums(X) == ncol(X)), unit = "ms")
Table: Benchmarking of colAlls(), apply+all() and colSums==n() 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 | 0.012207 | 0.0138865 | 0.0155181 | 0.015215 | 0.016485 | 0.025999 |
3 | colSums==n | 0.013881 | 0.0158550 | 0.0177842 | 0.017109 | 0.019051 | 0.041874 |
2 | apply+all | 0.880228 | 0.9383155 | 1.0128847 | 1.005190 | 1.036112 | 2.638512 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000 |
3 | colSums==n | 1.137134 | 1.141756 | 1.146028 | 1.124482 | 1.155657 | 1.6106 |
2 | apply+all | 72.108462 | 67.570338 | 65.271009 | 66.065725 | 62.851835 | 101.4851 |
Table: Benchmarking of rowAlls(), apply+all() and rowSums==n() 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 | 0.019494 | 0.0229110 | 0.0251603 | 0.0247665 | 0.0264305 | 0.041038 |
3 | rowSums==n | 0.032585 | 0.0354995 | 0.0388549 | 0.0381830 | 0.0403165 | 0.062119 |
2 | apply+all | 0.879429 | 0.9777445 | 1.0366590 | 1.0117405 | 1.0394245 | 2.616813 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAlls | 1.00000 | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 |
3 | rowSums==n | 1.67154 | 1.549452 | 1.544295 | 1.54172 | 1.525378 | 1.513695 |
2 | apply+all | 45.11280 | 42.675767 | 41.202205 | 40.85117 | 39.326706 | 63.765608 |
Figure: Benchmarking of colAlls(), apply+all() and colSums==n() on 10x1000 data as well as rowAlls(), apply+all() and rowSums==n() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colAlls() and rowAlls() 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 | 12.207 | 13.8865 | 15.51814 | 15.2150 | 16.4850 | 25.999 |
2 | rowAlls | 19.494 | 22.9110 | 25.16028 | 24.7665 | 26.4305 | 41.038 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowAlls | 1.596953 | 1.649876 | 1.621346 | 1.627769 | 1.603306 | 1.578445 |
Figure: Benchmarking of colAlls() and rowAlls() 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 1536318 82.1 2637877 140.9 2637877 140.9
Vcells 2144131 16.4 5986528 45.7 55745682 425.4
> colStats <- microbenchmark(colAlls = colAlls(X), `apply+all` = apply(X, MARGIN = 2L, FUN = all),
+ `colSums==n` = (colSums(X) == nrow(X)), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1536312 82.1 2637877 140.9 2637877 140.9
Vcells 2194174 16.8 5986528 45.7 55745682 425.4
> rowStats <- microbenchmark(rowAlls = rowAlls(X), `apply+all` = apply(X, MARGIN = 1L, FUN = all),
+ `rowSums==n` = (rowSums(X) == ncol(X)), unit = "ms")
Table: Benchmarking of colAlls(), apply+all() and colSums==n() 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 | 0.013471 | 0.0150050 | 0.0184525 | 0.0164855 | 0.0186845 | 0.051676 |
3 | colSums==n | 0.089160 | 0.0954235 | 0.1043528 | 0.1019440 | 0.1103905 | 0.148491 |
2 | apply+all | 1.426726 | 1.5364600 | 1.8411169 | 1.6440405 | 1.7629815 | 6.672309 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000 |
3 | colSums==n | 6.618662 | 6.359447 | 5.655213 | 6.183859 | 5.908132 | 2.8735 |
2 | apply+all | 105.910920 | 102.396535 | 99.776016 | 99.726457 | 94.355294 | 129.1181 |
Table: Benchmarking of rowAlls(), apply+all() and rowSums==n() 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 | 0.053982 | 0.0587140 | 0.0642004 | 0.0636055 | 0.068877 | 0.090047 |
3 | rowSums==n | 0.244231 | 0.2559055 | 0.3254041 | 0.2750305 | 0.297211 | 4.623414 |
2 | apply+all | 1.445115 | 1.5159245 | 1.7907320 | 1.6103005 | 1.761297 | 6.852790 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
3 | rowSums==n | 4.524304 | 4.358509 | 5.068566 | 4.324005 | 4.315098 | 51.34445 |
2 | apply+all | 26.770312 | 25.818791 | 27.892839 | 25.317001 | 25.571628 | 76.10237 |
Figure: Benchmarking of colAlls(), apply+all() and colSums==n() on 100x1000 data as well as rowAlls(), apply+all() and rowSums==n() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colAlls() and rowAlls() 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 | 13.471 | 15.005 | 18.45250 | 16.4855 | 18.6845 | 51.676 |
2 | rowAlls | 53.982 | 58.714 | 64.20042 | 63.6055 | 68.8770 | 90.047 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | rowAlls | 4.007275 | 3.912962 | 3.479226 | 3.858269 | 3.686317 | 1.74253 |
Figure: Benchmarking of colAlls() and rowAlls() 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 1536422 82.1 2637877 140.9 2637877 140.9
Vcells 2144722 16.4 5986528 45.7 55745682 425.4
> colStats <- microbenchmark(colAlls = colAlls(X), `apply+all` = apply(X, MARGIN = 2L, FUN = all),
+ `colSums==n` = (colSums(X) == nrow(X)), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1536416 82.1 2637877 140.9 2637877 140.9
Vcells 2194765 16.8 5986528 45.7 55745682 425.4
> rowStats <- microbenchmark(rowAlls = rowAlls(X), `apply+all` = apply(X, MARGIN = 1L, FUN = all),
+ `rowSums==n` = (rowSums(X) == ncol(X)), unit = "ms")
Table: Benchmarking of colAlls(), apply+all() and colSums==n() 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 | 0.002760 | 0.0037995 | 0.0052718 | 0.0047010 | 0.0058355 | 0.016144 |
3 | colSums==n | 0.096585 | 0.1059565 | 0.1122891 | 0.1132125 | 0.1173195 | 0.144481 |
2 | apply+all | 0.744418 | 0.8274860 | 0.9655296 | 0.8815355 | 0.9199280 | 3.360772 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.000000 |
3 | colSums==n | 34.99457 | 27.88696 | 21.29983 | 24.08264 | 20.10445 | 8.949517 |
2 | apply+all | 269.71667 | 217.78813 | 183.14885 | 187.52085 | 157.64339 | 208.174678 |
Table: Benchmarking of rowAlls(), apply+all() and rowSums==n() 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 | 0.051885 | 0.056650 | 0.0633111 | 0.0604540 | 0.0656025 | 0.231503 |
3 | rowSums==n | 0.248694 | 0.266145 | 0.2847173 | 0.2828595 | 0.3030625 | 0.325078 |
2 | apply+all | 0.734908 | 0.814167 | 0.9510324 | 0.8519450 | 0.9069325 | 3.404670 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowAlls | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
3 | rowSums==n | 4.793177 | 4.698058 | 4.497113 | 4.678921 | 4.619679 | 1.404206 |
2 | apply+all | 14.164171 | 14.371880 | 15.021568 | 14.092450 | 13.824664 | 14.706807 |
Figure: Benchmarking of colAlls(), apply+all() and colSums==n() on 1000x100 data as well as rowAlls(), apply+all() and rowSums==n() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colAlls() and rowAlls() 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 | 2.760 | 3.7995 | 5.27183 | 4.701 | 5.8355 | 16.144 |
2 | rowAlls | 51.885 | 56.6500 | 63.31113 | 60.454 | 65.6025 | 231.503 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colAlls | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 |
2 | rowAlls | 18.79891 | 14.90986 | 12.00933 | 12.85982 | 11.24197 | 14.33988 |
Figure: Benchmarking of colAlls() and rowAlls() on 1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C 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-2.1 matrixStats_0.52.2-9000 ggplot2_2.2.1 knitr_1.17
[5] R.devices_2.15.1-9000 R.utils_2.6.0 R.oo_1.21.0 R.methodsS3_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 compiler_3.4.2 plyr_1.8.4 highr_0.6.1 base64enc_0.1-4 tools_3.4.2
[7] digest_0.6.12 tibble_1.3.4 gtable_0.2.0 R.cache_0.12.0 lattice_0.20-35 rlang_0.1.2
[13] Matrix_1.2-11 mvtnorm_1.0-6 R.rsp_0.41.0-9000 grid_3.4.2 prompt_1.0.0 survival_2.41-3
[19] multcomp_1.4-7 TH.data_1.0-8 scales_0.5.0 clisymbols_1.2.0 codetools_0.2-15 splines_3.4.2
[25] MASS_7.3-47 mime_0.5.1 memuse_3.0-1 colorspace_1.3-2 labeling_0.3 sandwich_2.4-0
[31] lazyeval_0.2.1 munsell_0.4.3 markdown_0.8.1 crayon_1.3.4 Cairo_1.5-9 zoo_1.8-0
Total processing time was 7.19 secs.
To reproduce this report, do:
html <- matrixStats:::benchmark('colAlls')
Copyright Henrik Bengtsson. Last updated on 2017-11-04 15:04:52 (-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>