public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/fixinclude-speed-up)] Speed up fixincludes.
@ 2022-02-03 15:40 Martin Liska
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2022-02-03 15:40 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0ba77db8a29ad1d98937d1deedbe1ad86638fc23
commit 0ba77db8a29ad1d98937d1deedbe1ad86638fc23
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 | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index de5a37f6acc..92f3dfc39a9 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -258,12 +258,23 @@ 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
+ARG_MAX=`getconf ARG_MAX 2>/dev/null`
+LENGTH=`expr length "$all_dirs" + 10`
+
+if test -n "$ARG_MAX" && test $LENGTH -lt $ARG_MAX
+then
+ cd $LIB
+ mkdir -p $all_dirs
+ cd ..
+else
+ for file in $all_dirs; do
+ rm -rf $LIB/$file
+ if [ ! -d $LIB/$file ]
+ then mkdir $LIB/$file
+ fi
+ done
+fi
+
mkdir $LIB/root
# # # # # # # # # # # # # # # # # # # # #
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/marxin/heads/fixinclude-speed-up)] Speed up fixincludes.
@ 2022-02-03 14:55 Martin Liska
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2022-02-03 14:55 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7c16ffb796a7f646ce5b8ea2ca32dca2418a59b2
commit 7c16ffb796a7f646ce5b8ea2ca32dca2418a59b2
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, 3 insertions(+), 7 deletions(-)
diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index de5a37f6acc..cdc0ca2e4c4 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -258,13 +258,9 @@ 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
-mkdir $LIB/root
+cd $LIB
+mkdir -p $all_dirs
+cd ..
# # # # # # # # # # # # # # # # # # # # #
#
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-03 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 15:40 [gcc(refs/users/marxin/heads/fixinclude-speed-up)] Speed up fixincludes Martin Liska
-- strict thread matches above, loose matches on Subject: below --
2022-02-03 14:55 Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).