Minor optimizations to ContainerCollector.