I am in the process of buying a new laptop for work. I am a PhD student and use R and pyhton on a daily basis, often running large simulations. I was wondering what is most important for running R with large data sets and lots of simulations: processor speed or RAM?


Modern computers usually come with 2-4 GB of RAM, and at least on Windows the "recommended" version of R is still 32-bit, meaning that, unless you use the less well-supported 64-bit version of R, you won't be able to take advantage of more than 2-4 GB. On Linux, distributing a 64-bit version (which can use, for all practical purposes, an unlimited amount of memory if you have it) is more common. Furthermore, more RAM only results in faster processing up to the point where you're no longer frequently swapping out to your page file. Processor speed, on the other hand, is something that never hits these kinds of arbitrary limitations or diminishing returns.

That said, if performance is critical, the first thing to consider is using a faster language than R or Python. R and Python are great languages for non-performance-critical code where programmer convenience is important, but if you need speed, you'd probably be better off learning D, C#, Java, or even C++ and finding a good statistics library to go with them. These languages can be orders of magnitude faster than R and Python when dealing with similarly written code.

  • /me finds it odd that "D" is listed before "C++"... :sigh: +1 – Billy ONeal Nov 30 '10 at 22:44

Depends on the size of the simulation. If the simulation has enough data that it's not fitting in the working set (main memory), then the bottleneck is always going to be the hard disk. Increasing memory will improve performance in these cases by eliminating the hard disk from the loop, because main memory is several orders of magnitude faster than the hard disk. On the other hand, if the entire problem fits in RAM then the bottleneck will probably be CPU time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.