ggplot2 Benchmark
Lately a couple of questions have come up about byte compiling (using the
compiler package), the new
parallel package in R, and what this means for
performance. Here are results from a little benchmark I put together for
ggplot2 (because that's what the questions I saw were
asking specifically about).
Disclaimer
- this was quickly put together
- the way the current version of ggplot2 uses
proto/constructs functions, I suspect it is
particularly unlikely to benefit from byte compiling
- the recommended packages were all byte compiled in both benchmarks (because that
is the new default)
Method
There were two main parts to this benchmark.
- I wrote an R script. This included a small
function that would create some graphs in ggplot2 as
well as simulated data. Then I looped (using lapply)
through the columns of the simulated data plotting them. Then I started a
local cluster using 3 cores and looped through the columns again, this time
using parLapply.
- I wrote a Windows batch script that installed ggplot2
and all of its dependencies, and then ran the R
script I had written. It then reinstalled ggplot2
and all of its dependencies using byte compiling and again ran the
R script I wrote. Both runs were logged.
- Files:
Batch script
R script
Log from uncompiled packages
Log from compiled packages
Timings
|
|
lapply |
|
parLapply |
|
|
user |
system |
elapsed |
|
user |
system |
elapsed |
|
uncompiled |
183.81 |
2.25 |
186.16 |
|
1.01 |
0.76 |
75.84 |
|
compiled |
179.57 |
1.88 |
182.1 |
|
1.31 |
0.57 |
74.22 |
System and Versions
> sessionInfo()
R Under development (unstable) (2011-11-03 r57557)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] grid parallel stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.6
|
Processor |
Intel Core i7 920 2670 MHz |
|
CPU Clock |
2660.1 MHz |
|
L1 Cache: |
3 x 32 + 32 kB |
|
L2 Cache |
4 x 256 kB |
|
L3 Cache |
1 x 8192 kB |
|
Cores |
4 physical, 8 logical (HT) |
|
Motherboard chipset |
X58 |
|
System Bus Clock |
532 Mhz |
|
Frontside Buss Clock |
133.0 MHz QDR |
|
Multiplier |
20.0 |
|
Southbridge |
Intel ICH10R |
|
Memory Size |
6136 MB (6 x 1024) |
|
Memory Type |
DDR3-1066 (PC3-8500) |
|
Harddrive |
596 GB Raid 1 volume (2 x 640GB, partitioned WD drives) |
|
Video card |
Geforce 9600 GT w/ 512 MB on board memory |
|
OS |
Windows 7 Home Premium x64 (6.1.7601) |