Kaleidoscope IIIb (useR! 2011)

August 18, 2011

(This article was first published on Why? » R, and kindly contributed to R-bloggers)

O. Mersmann - The microbenchmark package

Slides and code (link).

SURGEON GENERAL’s WARNING: Microbenchmarks can lead to a distorted view of reality and massive loss of productivity

For a higher-order benchmarking package check out the rbenchmark package on R (suggestion from the speaker).

Why do we need micro-benchmarking? A simple example showed that it is currently very difficult to benchmark 1+1 and f= function() NULL  using system.time. Microbenchmark has a very simple interface. Unlike system.time, MB measures the times of each individual function call. Produces summary statistics and plots.

How does microbenchmark() work?

  • Linux: clock_getttime(), gethrtime();
  • MAC: mach_timebase_info();
  • Windows: QueryPerformanceCounter(), QueryPerformanceFrequency()


  1. Precision of clock is unknown: clock could drift, timing might be zero, might observe discrete values;
  2. Clock only measures elapsed time. Some of this time may not actually be the R process.
Countermeasures to these problems include configurable CPU warm-up phase, configurable order of execution, warning if timings underflow. There are problems with MacOS X and Windows XP.

Planned features:

  • More plotting functions;
  • Possibly use OS API;
  • Better diagnostic messages;
  • Estimate clock granularity.

Paul Murrell – Vector image processing

Problem: convert a pretty pdf map into an interactive SVG document.
PDF -> R -> SVG
Discussion of recent improvements to the core R graphics engine and grImport. Using the svg would produce a static svg. However, the gridSVG produces an interactive SVG. Use grid.animate, .garnish, .hyperlink, .script to make the picture interactive.
Looks like a very nice package.

To leave a comment for the author, please follow the link and comment on his blog: Why? » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.