I've had my performance hat on at work for the last couple of weeks, optimizing memory and CPU performance ahead of the deployment of a new system. I've been pretty pleased with the improvements we've made. We've got alot of in-process caching that increases speed incredibly, but has a hefty footprint. We were able to get that down quite a bit with some pretty clever ideas.
One of the major pushes was to reduce references, especially boxed references. That has proven a very effective strategy to reduce memory. I wish I could just throw generics at the boxing problem, but we'll have to wait a while longer for that. Another strategy was to take a close look at the data structures that hold the cached data. I rolled my own AVL tree implementation for a date-based index of the cached data, and I was able to improve both the CPU performance and it's footprint substantially.
We also implemented what I've called a local string intern pool. We've got alot of redundant string data, and we've used String.Intern in the past fairly successfully, but some analysis of our data revealed some local redundancy that we could use to reduce a 4-byte reference to a single byte that acts as an index into the local string pool. This will also help keep our memory from bloating on the move to 64-bits when all the references in the system double in size. (although at that point, we should have loads more memory to work with) This as the added benefit of eliminating the need for string comparisons in running searches against the cache.
All in all, we were able to reduce the footprint of the cache by about 40%. I thought someone googling for ways to reduce memory footprint and increase performance might benefit some from this information. Oh, and so Google puts this in the right context, this is related to: ASP.NET, CLR, C#, DotNet.