Some small perf improvements to the dijkstra algorithms.