Avoid Cwd::cwd as much as possible for a large speedup.