add cache for walkpath for better time performance

12mB memory usage in local test, but 200mB+ on web test