Rewrite using save-cwd.c and chdir to remove quadratic component of complexity.
authorJim Meyering <jim@meyering.net>
Sun, 15 Jun 1997 13:34:47 +0000 (13:34 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 15 Jun 1997 13:34:47 +0000 (13:34 +0000)
commit0bd4ecccc6c6547b998b029445c9d9ba36f5f73a
tree78d04923d8d5d60c3ca92c6297f0fb7256720ccd
parent4bb8c3ca1ee5d4edd260523088f1219e9b73ed53
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.
lib/makepath.c