<%@include file="includes/setup.md.rsp"%> <%@string colname="colTabulates"%> <%@string rowname="rowTabulates"%> <%@string fcnname="colRowTabulates_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. ## Data ```r <%=withCapture({ <%@include file="R/random-matrices.R"%> data <- rmatrices(mode = "integer", range = c(-10, 10)) })%> ``` ## 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( "colTabulates_X_S" = colTabulates(X_S, na.rm = FALSE), "colTabulates(X, rows, cols)" = colTabulates(X, rows = rows, cols = cols, na.rm = FALSE), "colTabulates(X[rows, cols])" = colTabulates(X[rows, cols], na.rm = FALSE), unit = "ms" ) X <- t(X) X_S <- t(X_S) gc() rowStats <- microbenchmark( "rowTabulates_X_S" = rowTabulates(X_S, na.rm = FALSE), "rowTabulates(X, cols, rows)" = rowTabulates(X, rows = cols, cols = rows, na.rm = FALSE), "rowTabulates(X[cols, rows])" = rowTabulates(X[cols, rows], na.rm = FALSE), unit = "ms" ) })%> ``` <% crBenchmarkResults(colStats, rowStats, tags=dataLabel) %> <% } # for (dataLabel ...) %> <%@include file="${footer}"%> <%--------------------------------------------------------------------------- HISTORY: 2015-06-07 o Created. ---------------------------------------------------------------------------%>