View Single Post
Old Mar 21st, 2007, 2:56 PM   #19
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,868
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Well, I'll explain where I'm coming from in my (potentially skewed) perspective.

By nature of the list being an indefenite size, its size should be considered infinite. If I had an ideal amount of 1,000,000 entries, 1,000,000 multiplied by an average class instance of 2kb, is 4 GB. My computer can't handle 4 GB of RAM. Even if the OS were to help minimize RAM by %97.5, my computer can't even handle a process of 100 MB cleanly.

Therefore, I know that this shouldn't even be labelled "optimization"... it's a necessity for the application to even function properly. It's a requirement.

It could be compared to MySQL and it's caching. One could consider that an optimization, but I'm almost sure that the MySQL developers considered it a requirement. I am guessing that the first versions of MySQL were designed with caching in mind. I speculate that they were coding up the methods for caching frequently accessed tables, before it was even first released.

Pertaining to the "do a lot of research into optimization techniques", like I said before. I don't consider this optimization. I consider this an obvious necessity to design a single function that will dump old RAM into a file when it hasn't been accessed in a while. This doesn't seem like something that one would need to research, it seems like there could be only one solution: dump the list indexes that haven't been needed.

That said, I've accomplished this in one function that does not slow down the program, and meets the requirement for RAM reduction. The variable parts however that DO need to be changed are the dump frequencies and variable ages. These will be changed depending on certain statistics from bench marking the performance. This is the the optimization that will happen at the end. Later, I will be able to analyze what kind of intervals and frequencies are required, and modify them accordingly to optimize. For now, the essential part of reducing RAM is more than adequate, and can be optimized later.

For now, I'm done, and it works perfectly. I've actually got an ingenius solution for randomizing which indexes are checked, that will mathematically guarantee RAM reduction while doing mere constant time checks.

All in all, this is just another part of the program. Not optimization. Optimizing small sections of the code, to increase the performance by small factors, will come later. I'm done with this portion of the program for now, so thanks for the help Arevos!
Sane is online now   Reply With Quote