[gcc r12-7031] Speed up fixincludes.

Martin Liska marxin@gcc.gnu.org
Thu Feb 3 17:46:36 GMT 2022


https://gcc.gnu.org/g:c7d0d03a6bfbd09dccaeaa0ed6c2e072c86e4792

commit r12-7031-gc7d0d03a6bfbd09dccaeaa0ed6c2e072c86e4792
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Feb 3 15:49:43 2022 +0100

    Speed up fixincludes.
    
    In my case:
    $ rm ./stmp-fixinc ; time make -j16
    
    takes 17 seconds, where I can reduce it easily with the suggested
    change. Then I get to 11.2 seconds.
    
    The scripts searches ~2500 folders in my case with total 20K header
    files.
    
    fixincludes/ChangeLog:
    
            * fixinc.in: Use mkdir -p rather that a loop.

Diff:
---
 fixincludes/fixinc.in | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index de5a37f6acc..0c3066452c6 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -258,12 +258,10 @@ then echo "All directories (including links to directories):"
      echo $all_dirs
 fi
 
-for file in $all_dirs; do
-  rm -rf $LIB/$file
-  if [ ! -d $LIB/$file ]
-  then mkdir $LIB/$file
-  fi
-done
+cd $LIB
+echo "$all_dirs" | xargs mkdir -p
+cd ..
+
 mkdir $LIB/root
 
 # # # # # # # # # # # # # # # # # # # # #


More information about the Gcc-cvs mailing list