I have been trying RRO, Microsoft’s improved open-source version of R. It is advertised as fully compatible with R, but achieving much better performance due to multi-threading allowing the use of all cores in multi-core processors. The tests in Revolution Analytics web site are impressive, and I have been able to reproduce them on my laptop (four-core i7 and 24GB RAM, Windows 7 Pro 64 bit).
Today, I decided to benchmark version 0.8.0 of the photobiology
package, just released. First table shows results using default settings, tuned for precision, rather than performance. The first table gives timings using these settings. Median times are in milliseconds per function call, and the number of returned summary values (photon irradiances) per function call is shown in the values column. The source_mspct
objects used in the tests are collections of four identical source_spct
objects. Package microbenchmark
was used for these tests, simply by enclosing each of the calls shown in the table, in a call to microbenchmark()
.
Function call | R 3.2.1 | RRO 3.2.1 | values | effective |
---|---|---|---|---|
ms | ms | number | 1 / s | |
Using numeric vectors |
||||
photon_irradiance(sun.spct$w.length, sun.spct$s.e.irrad, PAR()) |
0.8 | 0.8 | 1 | 1250 |
photon_irradiance(sun.spct$w.length, sun.spct$s.e.irrad, CIE()) |
0.9 | 0.86 | 1 | 1160 |
photon_irradiance(sun.spct$w.length, sun.spct$s.e.irrad, Plant_bands()) |
1.2 | 1.1 | 6 | 5450 |
Using source_spct objects |
||||
microbenchmark(q_irrad(sun.spct, PAR())) |
1.8 | 1.7 | 1 | 590 |
microbenchmark(q_irrad(sun.spct, CIE())) |
2.1 | 2.1 | 1 | 480 |
microbenchmark(q_irrad(sun.spct, Plant_bands())) |
3.0 | 3.0 | 6 | 2000 |
Using source_mspct objects |
||||
microbenchmark(q_irrad(test.mspct, PAR()))) |
6.5 | 6.5 | 4 | 615 |
microbenchmark(q_irrad(test.mspct, CIE()))) |
7.4 | 7.3 | 4 | 550 |
microbenchmark(q_irrad(test.mspct, Plant_bands())) |
11.0 | 11.1 | 24 | 2180 |
The second table shows results after setting option photobiology.use.hinges=FALSE
, as inserting values into an spectrum was found to be very expensive in computing time in earlier versions of the package.
Function call | R 3.2.1 | RRO 3.2.1 | values | effective |
---|---|---|---|---|
ms | ms | number | 1 / s | |
Using numeric vectors |
||||
photon_irradiance(sun.spct$w.length, sun.spct$s.e.irrad, PAR()) |
0.57 | 0.51 | 1 | 1960 |
photon_irradiance(sun.spct$w.length, sun.spct$s.e.irrad, CIE()) |
0.64 | 0.58 | 1 | 1720 |
photon_irradiance(sun.spct$w.length, sun.spct$s.e.irrad, Plant_bands()) |
0.9 | 0.83 | 6 | 7200 |
Using source_spct objects |
||||
microbenchmark(q_irrad(sun.spct, PAR())) |
0.75 | 0.69 | 1 | 1450 |
microbenchmark(q_irrad(sun.spct, CIE())) |
1.1 | 1.0 | 1 | 1000 |
microbenchmark(q_irrad(sun.spct, Plant_bands())) |
2.1 | 1.9 | 6 | 3160 |
Using source_mspct objects |
||||
microbenchmark(q_irrad(test.mspct, PAR()))) |
2.5 | 2.4 | 4 | 1670 |
microbenchmark(q_irrad(test.mspct, CIE()))) |
3.4 | 3.2 | 4 | 1250 |
microbenchmark(q_irrad(test.mspct, Plant_bands())) |
6.7 | 6.6 | 24 | 3640 |
We can conclude that for these function calls, switching to RRO, makes little difference. On the other hand computing several values in a single function call using a list of wavebands very significantly improves performance. Compared to benchmarking of the photobiology package done long ago, using hinges has less impact on throughput, which I suspect may be a result of both improvements to R
itself and in Rcpp
package. Rcpp (0.12.0) was used in these tests. Although tests were done with RRO, which uses by default MRAN (Managed R Archive Network), all packages were updated to the versions available today (2015-07-31) from CRAN so as to use the same versions for both RRO and R.