Optimize path-finding operations (RIPD-537)
[FOLD] Calculate hashes without holding locks and cache the result
[FOLD] Address comments