Saturday, August 4, 2007

Don't feed the Stata

Today, I set out to test how the amount memory allocated to Stata affects efficiency. The "set mem ___" command sets the amount of RAM to allocate to Stata. I remember reading something at some point that mentioned allocating too much memory can slow the program down but I figured it would be better to see for myself. Sure enough, it did.

The experiment was much like the previous ones. I did five trials of a program with 900m versus 450m allocated. I ran programs with 900m, then 450m, 450m, 900m, 900m, 450m, and so on so that one allocation wasn't always running before the other. I ran programs of varying lengths for each trial. Here are the results:

Trial #. 900m time, 450m time
1. 7:26, 6:22
2. 2:12, 2:02
3. 1:56, 1:40
4. 5:33, 4:43
5. 6:52, 6:16

About a 12% reduction in times by cutting the memory allocation in half. Don't feed Stata too much memory or it will get bloated and slow down.

No comments: