[R-SIG-Mac] R performance on OS X and a suggestion

Jasjeet Singh Sekhon sekhon at berkeley.edu
Fri May 26 07:42:49 CEST 2006


I've spent a lot of time improving the performance of my 'Matching'
package on OS X (as has a generous programmer in the OS X Performance
group at Apple).  For this package (and it is not alone) there has
been a large performance gap between OS X and Linux.  Even after many
memory and algorithmic optimizations (using BLAS etc), it is still
important for performance to not use the default OS X malloc.  It
starts using the kernel's virtual memory manager for allocations
greater than 15kb while the latest version of dmalloc only uses mmap
for allocations greater than 256kb.

However, a Linux speed advantage remains which varies with the size of
the dataset used. But the performance gap is much greater if the
default OS X malloc is used notwithstanding the new
algorithm. Therefore, I recommend that R for OS X be linked against
dmalloc just as it is for Windows.

For details see:


The memory issue affects a number of packages.  For example, the
growing number which depend on the very useful Scythe Statistical

The latest version of 'Matching' which I've just uploaded to CRAN
links against dmalloc (but only when it is built for OS X).  A more
elegant solution would be for the R OS X build to do so directly.


Jasjeet S. Sekhon                     
Associate Professor             
Travers Department of Political Science
Survey Research Center          
UC Berkeley                     

V: 510-642-9974  F: 617-507-5524

More information about the R-SIG-Mac mailing list