79 lines
1.8 KiB
Plaintext
79 lines
1.8 KiB
Plaintext
<%@include file="includes/setup.md.rsp"%>
|
|
|
|
<%@string colname="colRanks"%>
|
|
<%@string rowname="rowRanks"%>
|
|
<%@string fcnname="colRowRanks_subset"%>
|
|
<%@meta title="${colname}() and ${rowname}() benchmarks on subsetted computation"%>
|
|
<%@meta author="Dongcan Jiang"%>
|
|
<%@meta date="2015-06-07"%>
|
|
|
|
<%@include file="${header}"%>
|
|
|
|
|
|
# <%@meta name="title"%>
|
|
|
|
This report benchmark the performance of <%=colname%>() and <%=rowname%>() on subsetted computation.
|
|
|
|
|
|
<% for (mode in c("integer", "double")) { %>
|
|
|
|
## Data type "<%=mode%>"
|
|
|
|
### Data
|
|
```r
|
|
<%=withCapture({
|
|
<%@include file="R/random-matrices.R"%>
|
|
data <- rmatrices(mode = mode)
|
|
})%>
|
|
```
|
|
|
|
### Results
|
|
|
|
<% for (dataLabel in names(data)) { %>
|
|
<% mprintf("%s: %s\n", mode, dataLabel) %>
|
|
#### <%=dataLabel%> <%=mode%> matrix
|
|
|
|
```r
|
|
<%=withCapture({
|
|
X <- data[[.dataLabel.]]
|
|
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()
|
|
|
|
colStats <- microbenchmark(
|
|
"colRanks_X_S" = colRanks(X_S, na.rm = FALSE),
|
|
"colRanks(X, rows, cols)" = colRanks(X, rows = rows, cols = cols, na.rm = FALSE),
|
|
"colRanks(X[rows, cols])" = colRanks(X[rows, cols], na.rm = FALSE),
|
|
unit = "ms"
|
|
)
|
|
|
|
X <- t(X)
|
|
X_S <- t(X_S)
|
|
gc()
|
|
|
|
rowStats <- microbenchmark(
|
|
"rowRanks_X_S" = rowRanks(X_S, na.rm = FALSE),
|
|
"rowRanks(X, cols, rows)" = rowRanks(X, rows = cols, cols = rows, na.rm = FALSE),
|
|
"rowRanks(X[cols, rows])" = rowRanks(X[cols, rows], na.rm = FALSE),
|
|
unit = "ms"
|
|
)
|
|
})%>
|
|
```
|
|
|
|
<% crBenchmarkResults(colStats, rowStats, tags=c(mode, dataLabel)) %>
|
|
|
|
<% } # for (dataLabel ...) %>
|
|
|
|
<% } # for (mode ...) %>
|
|
|
|
|
|
<%@include file="${footer}"%>
|
|
|
|
|
|
<%---------------------------------------------------------------------------
|
|
HISTORY:
|
|
2015-06-07
|
|
o Created.
|
|
---------------------------------------------------------------------------%>
|