knitr::opts_chunk$set(fig.width=12, fig.height=8) library("RcppDynProg") library("WVPlots") library("microbenchmark") library("rqdatatable") set.seed(2018) n <- 500 x <- matrix(runif(n*n), nrow=n, ncol=n) solve_interval_partition(x, n) solve_interval_partition_R(x, n) timings <- microbenchmark( solve_interval_partition(x, n), solve_interval_partition_R(x, n), times = 5L) print(timings) p <- data.frame(timings) p$seconds <- p$time/1e+9 p$method <- as.factor(p$expr) p$method <- reorder(p$method, p$seconds) summary <- p %.>% project(., mean_seconds = mean(seconds), groupby = "method") print(summary) ratio <- max(summary$mean_seconds)/min(summary$mean_seconds) print(ratio) WVPlots::ScatterBoxPlotH(p, "seconds", "method", "performance of same dynamic programming code in R and Rcpp (C++)")
Timings on a 2018 Dell XPS-13 laptop, 16 Gib RAM, LPDDR3, 2133 MT/s, Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 cores reported), idle, charged, and plugged into power supply. Ubuntu 18.04.1 LTS.
R.version.string
R.version
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.