rbenchmark: R Benchmark 2.6

View source: R/rbenchmark.R

rbenchmarkR Documentation

R Benchmark 2.6

Description

This is a benchmark of base R with 15 tests of various common (matrix) calculations and programming techniques like loops, vector calculation, recursion, etc.

Usage

rbenchmark(runs = 3L)

## S3 method for class 'rbenchmark'
print(x, ...)

Arguments

runs

Number of times each test is run (3 by default).

x

A rbenchmark object

...

Further arguments (not used yet)

Details

This code is reworked from the R Benchmark 2.5 adapted by Simon Urbanek (https://mac.r-project.org/benchmarks/) from my initial implementation , itself inspired from Matlab code by Stephan Steinhaus. In comparison to version 2.5, this one is included in a function and returns a rbenchmark objects that prints in a very similar way to the original code. However, only functions from base R packages (including stats and utils) are used, where previous versions also used recommended package Matrix and possibly CRAN package SuppDists. Expect some slight differences.

Some tests in sections I and II use BLAS/LAPACK code. Their results are heavily dependent on the BLAS implementation that you choose. The default R BLAS is single-threaded and is rather slow, but it well tested and certified to be accurate. Use a good multi-threaded BLAS alternative for much improved results (sometimes 10x faster or more), like ATLAS, OpenBLAS, Intel MKL, ... See https://cran.r-project.org/web/packages/gcbd/vignettes/gcbd.pdf. Use utils::sessionInfo() to know which BLAS version R currently uses.

Beside multi-threaded BLAS, all tests are single-threaded. This benchmark does not test full parallel potential of R. Also, other key aspects like read and write of data on disk of from databases are not tested. As usual, take these artificial benchmarks with a grain of salt: it may not represent the speed of your actual calculations since it depends mainly on the functions you use and on your programming style...

Value

An rbenchmark object with the timing of all 15 tests.

Examples

## Not run: 
  # This can be slow
  rbenchmark()

## End(Not run)

SciViews/svMisc documentation built on Sept. 15, 2023, 3:51 a.m.