Cache paths where possible for significant speed-up.