Kaleidoscope IIIb (useR! 2011)
[This article was first published on Why? » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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()
Challenges:
- Precision of clock is unknown: clock could drift, timing might be zero, might observe discrete values;
- 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 their blog: Why? » R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.