-
Notifications
You must be signed in to change notification settings - Fork 34
colRowDiffs_subset
matrixStats: Benchmark report
This report benchmark the performance of colDiffs() and rowDiffs() on subsetted computation.
> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100,
+ +100), na_prob = 0) {
+ mode <- match.arg(mode)
+ n <- nrow * ncol
+ if (mode == "logical") {
+ x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+ } else if (mode == "index") {
+ x <- seq_len(n)
+ mode <- "integer"
+ } else {
+ x <- runif(n, min = range[1], max = range[2])
+ }
+ storage.mode(x) <- mode
+ if (na_prob > 0)
+ x[sample(n, size = na_prob * n)] <- NA
+ dim(x) <- c(nrow, ncol)
+ x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+ set.seed(seed)
+ data <- list()
+ data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+ data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+ data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+ data[[4]] <- t(data[[3]])
+ data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+ data[[6]] <- t(data[[5]])
+ names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+ data
+ }
> data <- rmatrices(mode = mode)
> 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 3113624 166.3 5709258 305.0 5709258 305.0
Vcells 5834546 44.6 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3112797 166.3 5709258 305.0 5709258 305.0
Vcells 5832508 44.5 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.001091 | 0.0012340 | 0.0023884 | 0.0013290 | 0.001448 | 0.101899 |
2 | colDiffs(X, rows, cols) | 0.001271 | 0.0014815 | 0.0016570 | 0.0015785 | 0.001671 | 0.003063 |
3 | colDiffs(X[rows, cols]) | 0.001570 | 0.0019545 | 0.0021673 | 0.0020585 | 0.002199 | 0.008013 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.0000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | colDiffs(X, rows, cols) | 1.164986 | 1.200567 | 0.6937606 | 1.187735 | 1.154006 | 0.0300592 |
3 | colDiffs(X[rows, cols]) | 1.439047 | 1.583874 | 0.9074302 | 1.548909 | 1.518646 | 0.0786367 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on integer+10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.001095 | 0.0012615 | 0.0014586 | 0.0013540 | 0.0014220 | 0.006309 |
2 | rowDiffs(X, cols, rows) | 0.001318 | 0.0015310 | 0.0026410 | 0.0016080 | 0.0017385 | 0.093415 |
3 | rowDiffs(X[cols, rows]) | 0.001568 | 0.0019345 | 0.0021375 | 0.0020505 | 0.0021545 | 0.006355 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.203653 | 1.213635 | 1.810662 | 1.187592 | 1.222574 | 14.806626 |
3 | rowDiffs(X[cols, rows]) | 1.431963 | 1.533492 | 1.465429 | 1.514402 | 1.515119 | 1.007291 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+10x10 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+10x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.091 | 1.2340 | 2.38836 | 1.329 | 1.448 | 101.899 |
2 | rowDiffs_X_S | 1.095 | 1.2615 | 1.45861 | 1.354 | 1.422 | 6.309 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.0000000 | 1.000000 | 1.0000000 | 1.0000000 |
2 | rowDiffs_X_S | 1.003666 | 1.022285 | 0.6107161 | 1.018811 | 0.9820442 | 0.0619142 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3111391 166.2 5709258 305.0 5709258 305.0
Vcells 5501366 42.0 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3111385 166.2 5709258 305.0 5709258 305.0
Vcells 5506449 42.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.005324 | 0.0055875 | 0.0081225 | 0.0057265 | 0.0089555 | 0.039719 |
2 | colDiffs(X, rows, cols) | 0.008646 | 0.0089740 | 0.0107692 | 0.0091480 | 0.0094515 | 0.046548 |
3 | colDiffs(X[rows, cols]) | 0.012920 | 0.0132015 | 0.0212689 | 0.0135625 | 0.0214185 | 0.178538 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.623967 | 1.606085 | 1.325854 | 1.597485 | 1.055385 | 1.171933 |
3 | colDiffs(X[rows, cols]) | 2.426747 | 2.362685 | 2.618527 | 2.368375 | 2.391659 | 4.495028 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on integer+100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.005338 | 0.0055090 | 0.0057910 | 0.0056115 | 0.0057570 | 0.010078 |
2 | rowDiffs(X, cols, rows) | 0.008235 | 0.0084540 | 0.0086759 | 0.0085615 | 0.0087395 | 0.012207 |
3 | rowDiffs(X[cols, rows]) | 0.012938 | 0.0131685 | 0.0138666 | 0.0132730 | 0.0134630 | 0.056660 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.542713 | 1.534580 | 1.498175 | 1.525706 | 1.518065 | 1.211252 |
3 | rowDiffs(X[cols, rows]) | 2.423754 | 2.390361 | 2.394532 | 2.365321 | 2.338544 | 5.622147 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+100x100 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+100x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 5.338 | 5.5090 | 5.79096 | 5.6115 | 5.7570 | 10.078 |
1 | colDiffs_X_S | 5.324 | 5.5875 | 8.12247 | 5.7265 | 8.9555 | 39.719 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.0000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
1 | colDiffs_X_S | 0.9973773 | 1.014249 | 1.402612 | 1.020494 | 1.555584 | 3.941159 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3112146 166.3 5709258 305.0 5709258 305.0
Vcells 5505452 42.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3112137 166.3 5709258 305.0 5709258 305.0
Vcells 5510530 42.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.005339 | 0.0055580 | 0.0058249 | 0.0056480 | 0.0057980 | 0.009813 |
2 | colDiffs(X, rows, cols) | 0.009087 | 0.0093785 | 0.0097250 | 0.0094570 | 0.0095825 | 0.031486 |
3 | colDiffs(X[rows, cols]) | 0.012544 | 0.0130270 | 0.0132707 | 0.0131635 | 0.0132730 | 0.016739 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.702004 | 1.687388 | 1.669549 | 1.674398 | 1.652725 | 3.208601 |
3 | colDiffs(X[rows, cols]) | 2.349504 | 2.343829 | 2.278259 | 2.330648 | 2.289238 | 1.705798 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on integer+1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.005727 | 0.0058745 | 0.0064510 | 0.0059620 | 0.0060875 | 0.039065 |
2 | rowDiffs(X, cols, rows) | 0.009787 | 0.0100330 | 0.0103754 | 0.0101645 | 0.0103020 | 0.025221 |
3 | rowDiffs(X[cols, rows]) | 0.014053 | 0.0145150 | 0.0148189 | 0.0146570 | 0.0148595 | 0.019932 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | rowDiffs(X, cols, rows) | 1.708923 | 1.707890 | 1.608329 | 1.704881 | 1.692320 | 0.6456163 |
3 | rowDiffs(X[cols, rows]) | 2.453815 | 2.470849 | 2.297144 | 2.458403 | 2.440986 | 0.5102265 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+1000x10 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+1000x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 5.339 | 5.5580 | 5.82494 | 5.648 | 5.7980 | 9.813 |
2 | rowDiffs_X_S | 5.727 | 5.8745 | 6.45101 | 5.962 | 6.0875 | 39.065 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs_X_S | 1.072673 | 1.056945 | 1.107481 | 1.055595 | 1.049931 | 3.980944 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3112349 166.3 5709258 305.0 5709258 305.0
Vcells 5506252 42.1 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3112343 166.3 5709258 305.0 5709258 305.0
Vcells 5511335 42.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.005130 | 0.005291 | 0.0055358 | 0.0053835 | 0.0054755 | 0.009254 |
2 | colDiffs(X, rows, cols) | 0.008535 | 0.008873 | 0.0092883 | 0.0089775 | 0.0090825 | 0.033128 |
3 | colDiffs(X[rows, cols]) | 0.013391 | 0.013846 | 0.0142119 | 0.0139950 | 0.0141920 | 0.019400 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.663743 | 1.676999 | 1.677862 | 1.667595 | 1.658753 | 3.579857 |
3 | colDiffs(X[rows, cols]) | 2.610331 | 2.616897 | 2.567280 | 2.599610 | 2.591909 | 2.096391 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on integer+10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.004781 | 0.004987 | 0.0054427 | 0.0050700 | 0.005226 | 0.029440 |
2 | rowDiffs(X, cols, rows) | 0.007709 | 0.007960 | 0.0082193 | 0.0080545 | 0.008212 | 0.012504 |
3 | rowDiffs(X[cols, rows]) | 0.012309 | 0.012498 | 0.0129289 | 0.0126135 | 0.012793 | 0.024966 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | rowDiffs(X, cols, rows) | 1.612424 | 1.596150 | 1.510162 | 1.588659 | 1.571374 | 0.4247283 |
3 | rowDiffs(X[cols, rows]) | 2.574566 | 2.506116 | 2.375478 | 2.487870 | 2.447952 | 0.8480299 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+10x1000 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+10x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 4.781 | 4.987 | 5.44266 | 5.0700 | 5.2260 | 29.440 |
1 | colDiffs_X_S | 5.130 | 5.291 | 5.53577 | 5.3835 | 5.4755 | 9.254 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
1 | colDiffs_X_S | 1.072997 | 1.060958 | 1.017107 | 1.061834 | 1.047742 | 0.3143342 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3112548 166.3 5709258 305.0 5709258 305.0
Vcells 5528901 42.2 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3112542 166.3 5709258 305.0 5709258 305.0
Vcells 5578984 42.6 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.039308 | 0.0403705 | 0.0413522 | 0.0406230 | 0.0409395 | 0.077276 |
2 | colDiffs(X, rows, cols) | 0.073999 | 0.0760795 | 0.0775657 | 0.0762720 | 0.0766425 | 0.158858 |
3 | colDiffs(X[rows, cols]) | 0.108884 | 0.1122845 | 0.1129651 | 0.1126845 | 0.1133515 | 0.124285 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.882543 | 1.884532 | 1.875736 | 1.877557 | 1.872092 | 2.055722 |
3 | colDiffs(X[rows, cols]) | 2.770021 | 2.781350 | 2.731783 | 2.773909 | 2.768756 | 1.608326 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on integer+100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.039235 | 0.0397820 | 0.0419611 | 0.0404785 | 0.0410085 | 0.091386 |
2 | rowDiffs(X, cols, rows) | 0.067867 | 0.0685735 | 0.0712070 | 0.0699110 | 0.0704300 | 0.111323 |
3 | rowDiffs(X[cols, rows]) | 0.100585 | 0.1017305 | 0.1077241 | 0.1029630 | 0.1048435 | 0.195772 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.729757 | 1.723732 | 1.696977 | 1.727114 | 1.717449 | 1.218163 |
3 | rowDiffs(X[cols, rows]) | 2.563655 | 2.557199 | 2.567236 | 2.543647 | 2.556628 | 2.142254 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+100x1000 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+100x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 39.235 | 39.7820 | 41.96112 | 40.4785 | 41.0085 | 91.386 |
1 | colDiffs_X_S | 39.308 | 40.3705 | 41.35216 | 40.6230 | 40.9395 | 77.276 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.0000000 | 1.00000 | 1.0000000 | 1.0000 |
1 | colDiffs_X_S | 1.001861 | 1.014793 | 0.9854875 | 1.00357 | 0.9983174 | 0.8456 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3112764 166.3 5709258 305.0 5709258 305.0
Vcells 5529622 42.2 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3112758 166.3 5709258 305.0 5709258 305.0
Vcells 5579705 42.6 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.039726 | 0.0405095 | 0.0414681 | 0.041229 | 0.0416405 | 0.054515 |
2 | colDiffs(X, rows, cols) | 0.072423 | 0.0733265 | 0.0747335 | 0.074536 | 0.0749220 | 0.106975 |
3 | colDiffs(X[rows, cols]) | 0.101311 | 0.1028045 | 0.1059735 | 0.104548 | 0.1055730 | 0.172245 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.823063 | 1.810106 | 1.802191 | 1.807854 | 1.799258 | 1.962304 |
3 | colDiffs(X[rows, cols]) | 2.550244 | 2.537787 | 2.555541 | 2.535788 | 2.535344 | 3.159589 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on integer+1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.040435 | 0.0408685 | 0.0414823 | 0.0410570 | 0.0415155 | 0.053527 |
2 | rowDiffs(X, cols, rows) | 0.072863 | 0.0733020 | 0.0739522 | 0.0735420 | 0.0739435 | 0.081630 |
3 | rowDiffs(X[cols, rows]) | 0.111725 | 0.1124385 | 0.1151624 | 0.1128715 | 0.1141905 | 0.212579 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.801978 | 1.793606 | 1.782741 | 1.791217 | 1.781106 | 1.525025 |
3 | rowDiffs(X[cols, rows]) | 2.763076 | 2.751227 | 2.776185 | 2.749141 | 2.750551 | 3.971435 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on integer+1000x100 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on integer+1000x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 40.435 | 40.8685 | 41.48227 | 41.057 | 41.5155 | 53.527 |
1 | colDiffs_X_S | 39.726 | 40.5095 | 41.46814 | 41.229 | 41.6405 | 54.515 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.0000000 | 1.0000000 | 1.0000000 | 1.000000 | 1.000000 | 1.000000 |
1 | colDiffs_X_S | 0.9824657 | 0.9912157 | 0.9996594 | 1.004189 | 1.003011 | 1.018458 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() 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), na_prob = 0) {
+ mode <- match.arg(mode)
+ n <- nrow * ncol
+ if (mode == "logical") {
+ x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+ } else if (mode == "index") {
+ x <- seq_len(n)
+ mode <- "integer"
+ } else {
+ x <- runif(n, min = range[1], max = range[2])
+ }
+ storage.mode(x) <- mode
+ if (na_prob > 0)
+ x[sample(n, size = na_prob * n)] <- NA
+ dim(x) <- c(nrow, ncol)
+ x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+ set.seed(seed)
+ data <- list()
+ data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+ data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+ data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+ data[[4]] <- t(data[[3]])
+ data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+ data[[6]] <- t(data[[5]])
+ names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+ data
+ }
> data <- rmatrices(mode = mode)
> 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 3112982 166.3 5709258 305.0 5709258 305.0
Vcells 5620704 42.9 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3112967 166.3 5709258 305.0 5709258 305.0
Vcells 5620872 42.9 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.001221 | 0.0013660 | 0.0017599 | 0.0014260 | 0.0015315 | 0.030316 |
2 | colDiffs(X, rows, cols) | 0.001333 | 0.0015735 | 0.0017206 | 0.0016345 | 0.0017520 | 0.005095 |
3 | colDiffs(X[rows, cols]) | 0.001923 | 0.0021990 | 0.0023842 | 0.0022755 | 0.0024230 | 0.009834 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.0000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | colDiffs(X, rows, cols) | 1.091728 | 1.151903 | 0.9776525 | 1.146213 | 1.143976 | 0.1680631 |
3 | colDiffs(X[rows, cols]) | 1.574939 | 1.609810 | 1.3547016 | 1.595722 | 1.582109 | 0.3243832 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on double+10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.001180 | 0.0012805 | 0.0013782 | 0.0013225 | 0.0014020 | 0.003003 |
2 | rowDiffs(X, cols, rows) | 0.001353 | 0.0015270 | 0.0018422 | 0.0015790 | 0.0017075 | 0.024083 |
3 | rowDiffs(X[cols, rows]) | 0.001767 | 0.0019435 | 0.0020706 | 0.0019910 | 0.0021120 | 0.005571 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.146610 | 1.192503 | 1.336722 | 1.193951 | 1.217903 | 8.019647 |
3 | rowDiffs(X[cols, rows]) | 1.497458 | 1.517767 | 1.502463 | 1.505482 | 1.506419 | 1.855145 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+10x10 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+10x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.180 | 1.2805 | 1.37817 | 1.3225 | 1.4020 | 3.003 |
1 | colDiffs_X_S | 1.221 | 1.3660 | 1.75993 | 1.4260 | 1.5315 | 30.316 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
1 | colDiffs_X_S | 1.034746 | 1.066771 | 1.277005 | 1.078261 | 1.092368 | 10.09524 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3113184 166.3 5709258 305.0 5709258 305.0
Vcells 5626639 43.0 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3113178 166.3 5709258 305.0 5709258 305.0
Vcells 5636722 43.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.004421 | 0.0049180 | 0.0059535 | 0.006255 | 0.0066635 | 0.010450 |
2 | colDiffs(X, rows, cols) | 0.007536 | 0.0080215 | 0.0085251 | 0.008248 | 0.0085180 | 0.019900 |
3 | colDiffs(X[rows, cols]) | 0.019850 | 0.0205255 | 0.0224120 | 0.021927 | 0.0224355 | 0.067467 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.704592 | 1.631049 | 1.431950 | 1.318625 | 1.278307 | 1.904306 |
3 | colDiffs(X[rows, cols]) | 4.489934 | 4.173546 | 3.764506 | 3.505516 | 3.366924 | 6.456172 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on double+100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.004366 | 0.0049175 | 0.0059636 | 0.0062895 | 0.006589 | 0.008911 |
2 | rowDiffs(X, cols, rows) | 0.007813 | 0.0083855 | 0.0088068 | 0.0086520 | 0.008881 | 0.013165 |
3 | rowDiffs(X[cols, rows]) | 0.011526 | 0.0122080 | 0.0139787 | 0.0137565 | 0.014331 | 0.045332 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.789510 | 1.705236 | 1.476767 | 1.375626 | 1.347852 | 1.477388 |
3 | rowDiffs(X[cols, rows]) | 2.639945 | 2.482562 | 2.344003 | 2.187217 | 2.174989 | 5.087196 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+100x100 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+100x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 4.421 | 4.9180 | 5.95349 | 6.2550 | 6.6635 | 10.450 |
2 | rowDiffs_X_S | 4.366 | 4.9175 | 5.96359 | 6.2895 | 6.5890 | 8.911 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.0000000 | 1.0000000 | 1.000000 | 1.000000 | 1.0000000 | 1.0000000 |
2 | rowDiffs_X_S | 0.9875594 | 0.9998983 | 1.001696 | 1.005516 | 0.9888197 | 0.8527273 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3113393 166.3 5709258 305.0 5709258 305.0
Vcells 5628027 43.0 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3113387 166.3 5709258 305.0 5709258 305.0
Vcells 5638110 43.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.004376 | 0.0051410 | 0.0078655 | 0.0066685 | 0.0074575 | 0.029527 |
2 | colDiffs(X, rows, cols) | 0.007692 | 0.0084225 | 0.0107188 | 0.0087285 | 0.0096460 | 0.034947 |
3 | colDiffs(X[rows, cols]) | 0.020139 | 0.0207075 | 0.0258190 | 0.0222230 | 0.0237175 | 0.070039 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.757770 | 1.638300 | 1.362754 | 1.308915 | 1.293463 | 1.183561 |
3 | colDiffs(X[rows, cols]) | 4.602148 | 4.027913 | 3.282552 | 3.332534 | 3.180355 | 2.372032 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on double+1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.004147 | 0.005472 | 0.0067631 | 0.0063880 | 0.0067495 | 0.038996 |
2 | rowDiffs(X, cols, rows) | 0.009847 | 0.010400 | 0.0109062 | 0.0106120 | 0.0107630 | 0.029539 |
3 | rowDiffs(X[cols, rows]) | 0.013736 | 0.015166 | 0.0158284 | 0.0159175 | 0.0162925 | 0.021415 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | rowDiffs(X, cols, rows) | 2.374488 | 1.900585 | 1.612601 | 1.661240 | 1.594637 | 0.7574879 |
3 | rowDiffs(X[cols, rows]) | 3.312274 | 2.771564 | 2.340399 | 2.491782 | 2.413883 | 0.5491589 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+1000x10 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+1000x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 4.147 | 5.472 | 6.76313 | 6.3880 | 6.7495 | 38.996 |
1 | colDiffs_X_S | 4.376 | 5.141 | 7.86552 | 6.6685 | 7.4575 | 29.527 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.000000 | 1.0000000 | 1.000 | 1.00000 | 1.000000 | 1.0000000 |
1 | colDiffs_X_S | 1.055221 | 0.9395102 | 1.163 | 1.04391 | 1.104897 | 0.7571802 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3113599 166.3 5709258 305.0 5709258 305.0
Vcells 5628164 43.0 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3113593 166.3 5709258 305.0 5709258 305.0
Vcells 5638247 43.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.004063 | 0.0045650 | 0.0057744 | 0.0055980 | 0.0060260 | 0.036479 |
2 | colDiffs(X, rows, cols) | 0.008793 | 0.0092485 | 0.0100056 | 0.0094615 | 0.0096425 | 0.052644 |
3 | colDiffs(X[rows, cols]) | 0.013318 | 0.0143585 | 0.0154045 | 0.0153940 | 0.0159020 | 0.022930 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | colDiffs(X, rows, cols) | 2.164164 | 2.025958 | 1.732763 | 1.690157 | 1.600149 | 1.4431317 |
3 | colDiffs(X[rows, cols]) | 3.277874 | 3.145345 | 2.667724 | 2.749911 | 2.638898 | 0.6285808 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on double+10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.003720 | 0.0054570 | 0.0060726 | 0.005778 | 0.006033 | 0.033113 |
2 | rowDiffs(X, cols, rows) | 0.007415 | 0.0079015 | 0.0085686 | 0.008188 | 0.008419 | 0.040076 |
3 | rowDiffs(X[cols, rows]) | 0.011631 | 0.0135290 | 0.0142688 | 0.013870 | 0.014210 | 0.034452 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 1.993280 | 1.447957 | 1.411026 | 1.417099 | 1.395492 | 1.210280 |
3 | rowDiffs(X[cols, rows]) | 3.126613 | 2.479201 | 2.349689 | 2.400485 | 2.355379 | 1.040437 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+10x1000 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+10x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 4.063 | 4.565 | 5.77439 | 5.598 | 6.026 | 36.479 |
2 | rowDiffs_X_S | 3.720 | 5.457 | 6.07263 | 5.778 | 6.033 | 33.113 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.0000000 | 1.0000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | rowDiffs_X_S | 0.9155796 | 1.1954 | 1.051649 | 1.032154 | 1.001162 | 0.9077277 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3113798 166.3 5709258 305.0 5709258 305.0
Vcells 5673577 43.3 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3113792 166.3 5709258 305.0 5709258 305.0
Vcells 5773660 44.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.033815 | 0.035542 | 0.0800326 | 0.0492765 | 0.1263535 | 0.169962 |
2 | colDiffs(X, rows, cols) | 0.066597 | 0.068433 | 0.1108244 | 0.0825050 | 0.1708720 | 0.205080 |
3 | colDiffs(X[rows, cols]) | 0.187242 | 0.192313 | 0.3433570 | 0.2327500 | 0.3806580 | 7.369489 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.969451 | 1.925412 | 1.384741 | 1.674327 | 1.352333 | 1.206623 |
3 | colDiffs(X[rows, cols]) | 5.537247 | 5.410866 | 4.290212 | 4.723347 | 3.012643 | 43.359627 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on double+100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.033111 | 0.0363000 | 0.0736204 | 0.0416885 | 0.1268655 | 0.142161 |
2 | rowDiffs(X, cols, rows) | 0.067007 | 0.0684435 | 0.1836151 | 0.0820270 | 0.1715915 | 7.180782 |
3 | rowDiffs(X[cols, rows]) | 0.107105 | 0.1115635 | 0.1933004 | 0.1298830 | 0.3001800 | 0.325740 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowDiffs(X, cols, rows) | 2.023708 | 1.885496 | 2.494080 | 1.967617 | 1.352547 | 50.511617 |
3 | rowDiffs(X[cols, rows]) | 3.234726 | 3.073375 | 2.625638 | 3.115559 | 2.366128 | 2.291346 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+100x1000 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+100x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 33.111 | 36.300 | 73.62036 | 41.6885 | 126.8655 | 142.161 |
1 | colDiffs_X_S | 33.815 | 35.542 | 80.03263 | 49.2765 | 126.3535 | 169.962 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
2 | rowDiffs_X_S | 1.000000 | 1.0000000 | 1.000000 | 1.000000 | 1.0000000 | 1.00000 |
1 | colDiffs_X_S | 1.021262 | 0.9791185 | 1.087099 | 1.182017 | 0.9959642 | 1.19556 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
> 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 3114014 166.4 5709258 305.0 5709258 305.0
Vcells 5673724 43.3 22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colDiffs_X_S = colDiffs(X_S), `colDiffs(X, rows, cols)` = colDiffs(X,
+ rows = rows, cols = cols), `colDiffs(X[rows, cols])` = colDiffs(X[rows, cols]), unit = "ms")
> X <- t(X)
> X_S <- t(X_S)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3114008 166.4 5709258 305.0 5709258 305.0
Vcells 5773807 44.1 22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowDiffs_X_S = rowDiffs(X_S), `rowDiffs(X, cols, rows)` = rowDiffs(X,
+ rows = cols, cols = rows), `rowDiffs(X[cols, rows])` = rowDiffs(X[cols, rows]), unit = "ms")
Table: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 0.033956 | 0.0358095 | 0.0724575 | 0.0428235 | 0.125650 | 0.157237 |
2 | colDiffs(X, rows, cols) | 0.062317 | 0.0636225 | 0.1053283 | 0.0694575 | 0.164298 | 0.170479 |
3 | colDiffs(X[rows, cols]) | 0.108404 | 0.1147840 | 0.2376048 | 0.1349520 | 0.299808 | 4.780825 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | colDiffs(X, rows, cols) | 1.835228 | 1.776693 | 1.453656 | 1.621948 | 1.307585 | 1.084217 |
3 | colDiffs(X[rows, cols]) | 3.192484 | 3.205406 | 3.279227 | 3.151354 | 2.386057 | 30.405216 |
Table: Benchmarking of rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on double+1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 0.033388 | 0.0363885 | 0.1431267 | 0.0483815 | 0.1278610 | 6.522680 |
2 | rowDiffs(X, cols, rows) | 0.073139 | 0.0742570 | 0.1271230 | 0.0907515 | 0.1766875 | 0.481092 |
3 | rowDiffs(X[cols, rows]) | 0.115327 | 0.1184000 | 0.1909909 | 0.1368305 | 0.3002710 | 0.402991 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowDiffs_X_S | 1.000000 | 1.000000 | 1.0000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | rowDiffs(X, cols, rows) | 2.190577 | 2.040672 | 0.8881854 | 1.875748 | 1.381872 | 0.0737568 |
3 | rowDiffs(X[cols, rows]) | 3.454145 | 3.253775 | 1.3344183 | 2.828158 | 2.348417 | 0.0617830 |
Figure: Benchmarking of colDiffs_X_S(), colDiffs(X, rows, cols)() and colDiffs(X[rows, cols])() on double+1000x100 data as well as rowDiffs_X_S(), rowDiffs(X, cols, rows)() and rowDiffs(X[cols, rows])() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+1000x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 33.956 | 35.8095 | 72.45754 | 42.8235 | 125.650 | 157.237 |
2 | rowDiffs_X_S | 33.388 | 36.3885 | 143.12670 | 48.3815 | 127.861 | 6522.680 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colDiffs_X_S | 1.0000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | rowDiffs_X_S | 0.9832725 | 1.016169 | 1.975318 | 1.129789 | 1.017597 | 41.48311 |
Figure: Benchmarking of colDiffs_X_S() and rowDiffs_X_S() on double+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 22.4 secs.
To reproduce this report, do:
html <- matrixStats:::benchmark('colRowDiffs_subset')
Copyright Dongcan Jiang. Last updated on 2019-09-10 20:40:15 (-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>