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 created the package benchmarkme. 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 is now on CRAN and can be installed in the usual way
The benchmark_std() function assesses numerical operations such as loops and matrix operations. This benchmark comprises of three separate benchmarks: prog, matrix_fun, and matrix_cal. If you have less than 3GB of RAM (run `get_ram()` to find out how much is available on your system), then you should kill any memory hungry applications, e.g. firefox, and set `runs = 1` as an argument.
To benchmark your system, use
library("benchmarkme") res = benchmark_std(runs = 3)
You can compare your results to other users via
Finally upload your results for the benefit of other users
## You can control exactly what is uploaded. See details below. upload_results(res)
You can also compare your results using the Shiny interface. Simply create a results bundle
create_bundle(res, filename = "results.rds")
and upload to the webpage.
Two objects are uploaded:
1. Your benchmarks from benchmark_std or benchmark_io;
2. A summary of your system information (get_sys_details()).
The get_sys_details() returns:
– The `benchmarkme` version number;
– Unique ID – used to extract results;
– The current date.
The function Sys.info() does include the user and nodenames. In the public release of the data, this information will be removed. If you don’t wish to upload certain information, just set the corresponding argument, i.e.
upload_results(res, args = list(sys_info=FALSE))