Commit 0bd4ecccc6c6547b998b029445c9d9ba36f5f73a

Jim Meyering 1997-06-15T13:34:47

Rewrite using save-cwd.c and chdir to remove quadratic component of complexity. Before, it processed O(n^2) directory name components via stat and mkdir. Now it's O(n). This makes mkdir -p a lot more efficient when creating directories with very many components. On a Linux 2.0.30 ext2fs filesystem this command: mkdir -p `perl -e 'print "a/" x 500'` now runs in 0.77 seconds (user+sys). Contrast that with the 9.5(!) seconds it took before.