74 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2025-01-12 00:52:51 +08:00
<%@include file="includes/setup.md.rsp"%>
<%@string colname="colAnys"%>
<%@string rowname="rowAnys"%>
<%@string fcnname="colRowAnys_subset"%>
<%@meta title="${colname}() and ${rowname}() benchmarks on subsetted computation"%>
<%@meta author="Dongcan Jiang"%>
<%@meta date="2015-06-06"%>
<%@include file="${header}"%>
# <%@meta name="title"%>
This report benchmark the performance of <%=colname%>() and <%=rowname%>() on subsetted computation.
## Data
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode = "logical")
})%>
```
## Results
<% for (dataLabel in names(data)) { %>
<% message(dataLabel) %>
### <%=dataLabel%> 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(
"colAnys_X_S" = colAnys(X_S),
"colAnys(X, rows, cols)" = colAnys(X, rows = rows, cols = cols),
"colAnys(X[rows, cols])" = colAnys(X[rows, cols]),
unit = "ms"
)
X <- t(X)
X_S <- t(X_S)
gc()
rowStats <- microbenchmark(
"rowAnys_X_S" = rowAnys(X_S),
"rowAnys(X, cols, rows)" = rowAnys(X, rows = cols, cols = rows),
"rowAnys(X[cols, rows])" = rowAnys(X[cols, rows]),
unit = "ms"
)
})%>
```
<% crBenchmarkResults(colStats, rowStats, tags=dataLabel) %>
<% } # for (dataLabel ...) %>
<%@include file="${footer}"%>
<%---------------------------------------------------------------------------
HISTORY:
2015-06-06
o Created.
---------------------------------------------------------------------------%>