introduce small performance optimization (1.669s -> 1.509s in testWalk)