Memory is cheaper than you think.
Many developers spend time trying to save memory without much thought about how much their time is worth and how much the memory is worth.
The occasional Java forum question about how to save a few MB of memory, fails to consider how much money that memory is worth.
I have compiled a list of machines sold by a major vendor, by memory in them and included the list price for them. These systems support Windows, Lunix and Java. I have made the assumption that machines wth more memory need more processing power, indicated by the GHz and are only included as they have a baring on the price.
In the last column you can see that the cost is about £80 per GB. Given a typical developer costs over £40/h, this suggests it is worh spending about 2 hours to save 1 GB. Sometimes it is worth spending time saving memory.
However, how much time is 1 MB worth? About 7 seconds. This is significant because I often otimise my code to save a lot less than 1 MB and I spend more than 7 seconds doing it (including testing and bugs introduced etc). I am sure I am not alone.
Suggested time to spend saving memory
Here is a quick table of memory saved and suggested time to spend doing it.
|10 KB||70 ms||less than the time it takes to type 1 key|
|100 KB||700 ms|
|1 MB||7 s|
|10 MB||72 s||about the time it takes to fix and test one very simple bug|
|100 MB||12 min||about the time it takes to fix and test one bug|
|1 GB||2 hours||about the time it takes to fix and test one serious bug|
|10 GB||3 days||about the time it takes to re-engineer a key componen|
Cost of workstations and servers
Without a screen