When discussing how to speed up slow R code, my first question is what is your computer spec? It always surprises me when complex biological experiments, costing a significant amount of money, are analysed using a six year old laptop. A new desktop machine costs around £1000 and that money would be saved within a month in user time. Typically the more the RAM you have, the larger the dataset you can handle. However it’s not so obvious of the benefit of upgrading the processor.
To quantify the impact of the CPU on an analysis, I’ve create a simple benchmarking package. The aim of this package is to provide a set of benchmarks routines and data from past runs. You can then compare your machine, with other CPUs. The package currently isn’t on CRAN, but you can install it via my drat repository
install.packages(c("drat", "httr", "Matrix")) drat::addRepo("csgillespie") install.packages("benchmarkme", type="source")
You can load the package in the usual way, and view past results via
Currently around forty machines have been benchmarked. To benchmark and compare your own system just run
## On slower machines, reduce runs.
res = benchmark_std(runs=3)
The final step is to upload your benchmarks
## You can control exactly what is uploaded. See the help page
The current record is held by a Intel(R) Core(TM) i7-4712MQ CPU.