Significant speed improvements to cache pruning