util: optimize TreeUtil.getPathFromRoot()

No match.