Optimizations

Please report any regressions, we touched a lot of the memory system.