-
Notifications
You must be signed in to change notification settings - Fork 34
colRowMedians
matrixStats: Benchmark report
This report benchmark the performance of colMedians() and rowMedians() against alternative methods.
- apply() + median()
> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100,
+ +100), naProb = 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 (naProb > 0)
+ X[sample(n, size = naProb * 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)
> X <- data[["10x10"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 656647 35.1 1168576 62.5 1168576 62.5
Vcells 12135116 92.6 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654509 35.0 1168576 62.5 1168576 62.5
Vcells 12128708 92.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.0081 | 0.0154 | 0.0370 | 0.0212 | 0.0447 | 0.8034 |
apply+median | 0.4823 | 0.5386 | 0.7707 | 0.7634 | 0.8240 | 3.2590 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.000 |
apply+median | 59.66 | 34.97 | 20.81 | 36.05 | 18.45 | 4.056 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.0085 | 0.0108 | 0.0222 | 0.0183 | 0.0264 | 0.0708 |
apply+median | 0.4862 | 0.5018 | 0.6106 | 0.5216 | 0.7383 | 1.1772 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.0 | 1.00 | 1.00 | 1.00 | 1 | 1.00 |
apply+median | 57.4 | 46.55 | 27.48 | 28.52 | 28 | 16.62 |
Figure: Benchmarking of colMedians() and apply+median() on integer+10x10 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 | rowMedians | 8.470 | 10.78 | 22.22 | 18.29 | 26.37 | 70.83 |
1 | colMedians | 8.085 | 15.40 | 37.03 | 21.17 | 44.66 | 803.40 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowMedians | 1.0000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.00 |
1 | colMedians | 0.9545 | 1.429 | 1.667 | 1.158 | 1.693 | 11.34 |
Figure: Benchmarking of colMedians() and rowMedians() on integer+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 654570 35.0 1168576 62.5 1168576 62.5
Vcells 12129737 92.6 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654564 35.0 1168576 62.5 1168576 62.5
Vcells 12134780 92.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.1736 | 0.2156 | 0.254 | 0.2575 | 0.2741 | 1.206 |
apply+median | 5.1330 | 7.7029 | 8.683 | 7.9037 | 8.2165 | 41.385 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.0 |
apply+median | 29.57 | 35.73 | 34.19 | 30.69 | 29.98 | 34.3 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.1959 | 0.2048 | 0.260 | 0.2625 | 0.2983 | 0.4415 |
apply+median | 6.1620 | 7.9982 | 9.009 | 8.5262 | 8.9633 | 22.8178 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
apply+median | 31.45 | 39.05 | 34.65 | 32.48 | 30.04 | 51.68 |
Figure: Benchmarking of colMedians() and apply+median() on integer+100x100 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 173.6 | 215.6 | 254 | 257.5 | 274.1 | 1206.4 |
rowMedians | 195.9 | 204.8 | 260 | 262.5 | 298.3 | 441.5 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.000 | 1.00 | 1.000 | 1.000 | 1.000 | 1.000 |
rowMedians | 1.129 | 0.95 | 1.024 | 1.019 | 1.089 | 0.366 |
Figure: Benchmarking of colMedians() and rowMedians() on integer+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 654605 35.0 1168576 62.5 1168576 62.5
Vcells 12129760 92.6 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654599 35.0 1168576 62.5 1168576 62.5
Vcells 12134803 92.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.1763 | 0.199 | 0.2288 | 0.2244 | 0.2498 | 0.4581 |
apply+median | 1.2091 | 1.402 | 1.5806 | 1.4717 | 1.6062 | 3.9639 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
apply+median | 6.858 | 7.045 | 6.907 | 6.557 | 6.429 | 8.653 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.1886 | 0.2006 | 0.2319 | 0.2387 | 0.2491 | 0.3792 |
apply+median | 1.2946 | 1.3928 | 1.4640 | 1.4266 | 1.4761 | 2.5453 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
apply+median | 6.863 | 6.944 | 6.315 | 5.977 | 5.927 | 6.713 |
Figure: Benchmarking of colMedians() and apply+median() on integer+1000x10 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 176.3 | 199.0 | 228.8 | 224.4 | 249.8 | 458.1 |
rowMedians | 188.6 | 200.6 | 231.9 | 238.7 | 249.1 | 379.2 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.000 | 1.000 | 1.000 | 1.0000 | 1.0000 |
rowMedians | 1.07 | 1.008 | 1.013 | 1.063 | 0.9969 | 0.8277 |
Figure: Benchmarking of colMedians() and rowMedians() on integer+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 654643 35.0 1168576 62.5 1168576 62.5
Vcells 12130362 92.6 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654637 35.0 1168576 62.5 1168576 62.5
Vcells 12135405 92.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.2102 | 0.2187 | 0.2578 | 0.2614 | 0.2843 | 0.3661 |
apply+median | 46.2210 | 58.3153 | 68.2105 | 66.3304 | 73.2646 | 122.1813 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
apply+median | 219.9 | 266.7 | 264.6 | 253.8 | 257.7 | 333.7 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.2102 | 0.2152 | 0.2588 | 0.2645 | 0.2733 | 0.3588 |
apply+median | 45.9620 | 53.3136 | 61.0696 | 59.6471 | 63.9272 | 163.2089 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.0 | 1.0 | 1 | 1.0 | 1.0 | 1.0 |
apply+median | 218.7 | 247.8 | 236 | 225.5 | 233.9 | 454.9 |
Figure: Benchmarking of colMedians() and apply+median() on integer+10x1000 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 210.2 | 218.7 | 257.8 | 261.4 | 284.3 | 366.1 |
rowMedians | 210.2 | 215.2 | 258.8 | 264.5 | 273.3 | 358.8 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1 | 1.0000 | 1.000 | 1.000 | 1.0000 | 1.00 |
rowMedians | 1 | 0.9842 | 1.004 | 1.012 | 0.9614 | 0.98 |
Figure: Benchmarking of colMedians() and rowMedians() on integer+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 654678 35.0 1168576 62.5 1168576 62.5
Vcells 12130708 92.6 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654672 35 1168576 62.5 1168576 62.5
Vcells 12180751 93 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 1.637 | 2.025 | 2.166 | 2.139 | 2.205 | 4.451 |
apply+median | 55.133 | 72.293 | 82.732 | 79.919 | 90.246 | 122.047 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.00 | 1.0 | 1.00 | 1.00 | 1.00 |
apply+median | 33.67 | 35.71 | 38.2 | 37.37 | 40.92 | 27.42 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 1.782 | 1.813 | 1.974 | 1.858 | 2.094 | 2.687 |
apply+median | 53.285 | 67.142 | 74.188 | 71.343 | 77.067 | 141.831 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.00 | 1.00 | 1.00 | 1.0 | 1.0 | 1.00 |
apply+median | 29.91 | 37.04 | 37.58 | 38.4 | 36.8 | 52.79 |
Figure: Benchmarking of colMedians() and apply+median() on integer+100x1000 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 | |
---|---|---|---|---|---|---|---|
2 | rowMedians | 1.782 | 1.813 | 1.974 | 1.858 | 2.094 | 2.687 |
1 | colMedians | 1.637 | 2.025 | 2.166 | 2.139 | 2.205 | 4.451 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
1 | colMedians | 0.919 | 1.117 | 1.097 | 1.151 | 1.053 | 1.657 |
Figure: Benchmarking of colMedians() and rowMedians() on integer+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 654715 35.0 1168576 62.5 1168576 62.5
Vcells 12131126 92.6 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654709 35 1168576 62.5 1168576 62.5
Vcells 12181169 93 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 1.461 | 1.625 | 1.804 | 1.719 | 1.986 | 4.044 |
apply+median | 8.488 | 11.622 | 12.755 | 13.143 | 13.749 | 20.217 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.000 | 1.000 | 1.000 | 1.000 | 1 |
apply+median | 5.81 | 7.153 | 7.069 | 7.647 | 6.922 | 5 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 1.558 | 1.687 | 2.105 | 1.774 | 2.039 | 24.85 |
apply+median | 8.628 | 9.586 | 12.758 | 10.865 | 13.259 | 139.79 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.000 | 1.000 | 1.00 | 1.000 | 1.000 | 1.000 |
apply+median | 5.537 | 5.683 | 6.06 | 6.124 | 6.503 | 5.626 |
Figure: Benchmarking of colMedians() and apply+median() on integer+1000x100 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 1.461 | 1.625 | 1.804 | 1.719 | 1.986 | 4.044 |
rowMedians | 1.558 | 1.687 | 2.105 | 1.774 | 2.039 | 24.847 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
rowMedians | 1.067 | 1.038 | 1.167 | 1.032 | 1.026 | 6.145 |
Figure: Benchmarking of colMedians() and rowMedians() on integer+1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100,
+ +100), naProb = 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 (naProb > 0)
+ X[sample(n, size = naProb * 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)
> X <- data[["10x10"]]
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654758 35.0 1168576 62.5 1168576 62.5
Vcells 12247275 93.5 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654743 35.0 1168576 62.5 1168576 62.5
Vcells 12247403 93.5 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.0108 | 0.0192 | 0.0367 | 0.0239 | 0.0562 | 0.122 |
apply+median | 0.5151 | 0.7622 | 0.8520 | 0.8042 | 0.8981 | 1.633 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.0 | 1.00 | 1.00 | 1.00 | 1.00 |
apply+median | 47.78 | 39.6 | 23.22 | 33.69 | 15.98 | 13.38 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.0162 | 0.0185 | 0.0319 | 0.0262 | 0.0404 | 0.0743 |
apply+median | 0.7537 | 0.7699 | 0.8571 | 0.7765 | 0.9068 | 2.1796 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
apply+median | 46.62 | 41.66 | 26.85 | 29.66 | 22.43 | 29.34 |
Figure: Benchmarking of colMedians() and apply+median() on double+10x10 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 10.78 | 19.25 | 36.69 | 23.87 | 56.20 | 122.0 |
rowMedians | 16.17 | 18.48 | 31.92 | 26.18 | 40.42 | 74.3 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.0 | 1.00 | 1.00 | 1.000 | 1.0000 | 1.0000 |
rowMedians | 1.5 | 0.96 | 0.87 | 1.097 | 0.7192 | 0.6088 |
Figure: Benchmarking of colMedians() and rowMedians() on double+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 654786 35.0 1168576 62.5 1168576 62.5
Vcells 12247286 93.5 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654780 35.0 1168576 62.5 1168576 62.5
Vcells 12257329 93.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.4338 | 0.5857 | 0.6407 | 0.6537 | 0.6937 | 0.7437 |
apply+median | 5.2743 | 6.9086 | 8.1419 | 8.4682 | 8.8922 | 14.8565 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.0 | 1.00 | 1.00 | 1.00 | 1.00 |
apply+median | 12.16 | 11.8 | 12.71 | 12.96 | 12.82 | 19.98 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.4319 | 0.6026 | 0.6746 | 0.6858 | 0.7253 | 0.7899 |
apply+median | 5.3728 | 8.4070 | 8.8032 | 8.5795 | 8.8595 | 21.9304 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
apply+median | 12.44 | 13.95 | 13.05 | 12.51 | 12.22 | 27.76 |
Figure: Benchmarking of colMedians() and apply+median() on double+100x100 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 433.8 | 585.7 | 640.7 | 653.7 | 693.7 | 743.7 |
rowMedians | 431.9 | 602.6 | 674.6 | 685.8 | 725.3 | 789.9 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.0000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
rowMedians | 0.9956 | 1.029 | 1.053 | 1.049 | 1.046 | 1.062 |
Figure: Benchmarking of colMedians() and rowMedians() on double+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 654821 35.0 1168576 62.5 1168576 62.5
Vcells 12247991 93.5 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654815 35.0 1168576 62.5 1168576 62.5
Vcells 12258034 93.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.4115 | 0.5534 | 0.5683 | 0.5626 | 0.5953 | 0.9782 |
apply+median | 1.1664 | 1.7569 | 1.7738 | 1.8324 | 1.9048 | 3.3938 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.0 | 1.00 |
apply+median | 2.834 | 3.175 | 3.121 | 3.257 | 3.2 | 3.47 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.5266 | 0.6061 | 0.7037 | 0.6338 | 0.7047 | 2.593 |
apply+median | 1.7423 | 1.9109 | 2.3972 | 2.0306 | 2.1835 | 11.630 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
apply+median | 3.308 | 3.153 | 3.407 | 3.204 | 3.099 | 4.484 |
Figure: Benchmarking of colMedians() and apply+median() on double+1000x10 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 411.5 | 553.4 | 568.3 | 562.6 | 595.3 | 978.2 |
rowMedians | 526.6 | 606.1 | 703.7 | 633.8 | 704.7 | 2593.4 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
rowMedians | 1.28 | 1.095 | 1.238 | 1.127 | 1.184 | 2.651 |
Figure: Benchmarking of colMedians() and rowMedians() on double+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 654859 35.0 1168576 62.5 1168576 62.5
Vcells 12248017 93.5 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654853 35.0 1168576 62.5 1168576 62.5
Vcells 12258060 93.6 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 0.4388 | 0.4502 | 0.529 | 0.4929 | 0.5892 | 0.7549 |
apply+median | 47.8101 | 58.0928 | 64.496 | 63.2179 | 70.1561 | 90.9257 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.0 | 1 | 1.0 | 1.0 | 1.0 | 1.0 |
apply+median | 108.9 | 129 | 121.9 | 128.2 | 119.1 | 120.4 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 0.4388 | 0.496 | 0.5513 | 0.5049 | 0.6361 | 0.7618 |
apply+median | 47.3405 | 54.822 | 62.8189 | 59.3231 | 66.8636 | 167.3271 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
apply+median | 107.9 | 110.5 | 113.9 | 117.5 | 105.1 | 219.6 |
Figure: Benchmarking of colMedians() and apply+median() on double+10x1000 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 438.8 | 450.2 | 529.0 | 492.9 | 589.2 | 754.9 |
rowMedians | 438.8 | 496.0 | 551.3 | 504.9 | 636.1 | 761.8 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1 | 1.000 | 1.000 | 1.000 | 1.00 | 1.000 |
rowMedians | 1 | 1.102 | 1.042 | 1.024 | 1.08 | 1.009 |
Figure: Benchmarking of colMedians() and rowMedians() on double+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 654894 35.0 1168576 62.5 1168576 62.5
Vcells 12248942 93.5 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654888 35.0 1168576 62.5 1168576 62.5
Vcells 12348985 94.3 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 4.236 | 4.308 | 5.027 | 4.568 | 5.78 | 6.672 |
apply+median | 55.728 | 66.317 | 75.931 | 74.960 | 84.40 | 131.970 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.00 | 1.00 | 1.0 | 1.00 | 1.0 | 1.00 |
apply+median | 13.15 | 15.39 | 15.1 | 16.41 | 14.6 | 19.78 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 4.521 | 4.58 | 5.42 | 5.548 | 6.163 | 6.752 |
apply+median | 57.608 | 66.22 | 72.62 | 71.069 | 77.162 | 106.607 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.00 | 1.00 | 1.0 | 1.00 | 1.00 | 1.00 |
apply+median | 12.74 | 14.46 | 13.4 | 12.81 | 12.52 | 15.79 |
Figure: Benchmarking of colMedians() and apply+median() on double+100x1000 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 |
---|---|---|---|---|---|---|
colMedians | 4.236 | 4.308 | 5.027 | 4.568 | 5.780 | 6.672 |
rowMedians | 4.521 | 4.580 | 5.420 | 5.548 | 6.163 | 6.752 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
rowMedians | 1.067 | 1.063 | 1.078 | 1.215 | 1.066 | 1.012 |
Figure: Benchmarking of colMedians() and rowMedians() on double+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 654931 35.0 1168576 62.5 1168576 62.5
Vcells 12248967 93.5 35610798 271.7 68120027 519.8
> colStats <- microbenchmark(colMedians = colMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 2L,
+ FUN = median, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 654925 35.0 1168576 62.5 1168576 62.5
Vcells 12349010 94.3 35610798 271.7 68120027 519.8
> rowStats <- microbenchmark(rowMedians = rowMedians(X, na.rm = FALSE), `apply+median` = apply(X, MARGIN = 1L,
+ FUN = median, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
colMedians | 3.995 | 4.519 | 6.009 | 5.765 | 6.636 | 18.78 |
apply+median | 11.581 | 16.535 | 18.533 | 18.478 | 19.977 | 34.72 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
colMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
apply+median | 2.899 | 3.659 | 3.084 | 3.205 | 3.011 | 1.849 |
Table: Benchmarking of rowMedians() and apply+median() 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 |
---|---|---|---|---|---|---|
rowMedians | 3.686 | 3.968 | 4.473 | 4.032 | 4.651 | 7.419 |
apply+median | 10.706 | 11.652 | 14.290 | 12.639 | 15.434 | 25.911 |
expr | min | lq | mean | median | uq | max |
---|---|---|---|---|---|---|
rowMedians | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 |
apply+median | 2.905 | 2.937 | 3.195 | 3.135 | 3.319 | 3.492 |
Figure: Benchmarking of colMedians() and apply+median() on double+1000x100 data as well as rowMedians() and apply+median() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colMedians() and rowMedians() 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 | |
---|---|---|---|---|---|---|---|
2 | rowMedians | 3.686 | 3.968 | 4.473 | 4.032 | 4.651 | 7.419 |
1 | colMedians | 3.995 | 4.519 | 6.009 | 5.765 | 6.636 | 18.776 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowMedians | 1.000 | 1.000 | 1.000 | 1.00 | 1.000 | 1.000 |
1 | colMedians | 1.084 | 1.139 | 1.343 | 1.43 | 1.427 | 2.531 |
Figure: Benchmarking of colMedians() and rowMedians() on double+1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
R Under development (unstable) (2015-02-27 r67909)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] markdown_0.7.7 microbenchmark_1.4-2 matrixStats_0.14.0-9000
[4] ggplot2_1.0.0 knitr_1.9.3 R.devices_2.13.0
[7] R.utils_2.0.0 R.oo_1.19.0 R.methodsS3_1.7.0
loaded via a namespace (and not attached):
[1] Rcpp_0.11.4 splines_3.2.0 MASS_7.3-39
[4] munsell_0.4.2 lattice_0.20-30 colorspace_1.2-4
[7] R.cache_0.11.1-9000 multcomp_1.3-9 stringr_0.6.2
[10] plyr_1.8.1 tools_3.2.0 grid_3.2.0
[13] gtable_0.1.2 TH.data_1.0-6 survival_2.38-1
[16] digest_0.6.8 R.rsp_0.20.0 reshape2_1.4.1
[19] formatR_1.0.3 base64enc_0.1-3 mime_0.2.1
[22] evaluate_0.5.7 labeling_0.3 sandwich_2.3-2
[25] scales_0.2.4 mvtnorm_1.0-2 zoo_1.7-12
[28] Cairo_1.5-6 proto_0.3-10
Total processing time was 1.73 mins.
To reproduce this report, do:
html <- matrixStats:::benchmark('colMedians')
Copyright Henrik Bengtsson. Last updated on 2015-03-02 17:09:24 (-0800 UTC). Powered by RSP.
<script> var link = document.createElement('link'); link.rel = 'icon'; link.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAADFBMVEX9/v0AAP/9/v3//wBEQjoBAAAABHRSTlP//wD//gy7CwAAAGJJREFUOI3N0rESwCAIA9Ag///PXdoiBk0HhmbNO49DMETQCexNCSyFgdlGoO5DYOr9ThLgPosA7osIQP0sHuDOog8UI/ALa988wzdwXJRctf4s+d36YPTJ6aMd8ux3+QO4ABTtB85yDAh9AAAAAElFTkSuQmCC" document.getElementsByTagName('head')[0].appendChild(link); </script>