Speed up dirty tree check.