This also improves the performance of Path.countCloserThan.
This also improves the performance of Path.countCloserThan.