Explorar el Código

Reduced lfs_dir_traverse's explicit stack to 3 frames

This is possible thanks to invoxiaamo's optimization of compacting
renames to avoid the O(n^3) nested filters. Not only does this
significantly reduce the runtime cost of that operation, but it
reduces the maximum possible depth of recursion to 3 frames.

Deepest lfs_dir_traverse before:

traverse with commit
'-> traverse with filter
    '-> traverse with move
        '-> traverse with filter

Deepest lfs_dir_traverse after:

traverse with commit
'-> traverse with move
    '-> traverse with filter
Christopher Haster hace 3 años
padre
commit
abbfe8e92e
Se han modificado 1 ficheros con 3 adiciones y 4 borrados
  1. 3 4
      lfs.c

+ 3 - 4
lfs.c

@@ -767,11 +767,10 @@ static int lfs_dir_traverse_filter(void *p,
 // maximum recursive depth of lfs_dir_traverse, the deepest call:
 //
 // traverse with commit
-// '-> traverse with filter
-//     '-> traverse with move
-//         ' traverse with filter
+// '-> traverse with move
+//     '-> traverse with filter
 //
-#define LFS_DIR_TRAVERSE_DEPTH 4
+#define LFS_DIR_TRAVERSE_DEPTH 3
 
 struct lfs_dir_traverse {
     const lfs_mdir_t *dir;