On Wed, 10 Apr 2002, Allan Rae wrote:
[...]
> Compile times have blown out to be nearly ten times longer than they
> used to be two years ago.  It would be interesting to know how much of
> that is due to the now extensive use of STL, the extensive use of
> templates in the frontends/, the use of recursive make (we now have
> many more directories to recurse through than we did then), the use of
> intermediate linking, the use of Pimpl and other idioms and finally
> the use of automake (it generates our makefiles after all).
>
> There's probably a Masters or a PhD dissertation in the above so I
> doubt even a fraction of it might get done.  I do however hope that
> such points will be considered in future cleanup work.

Please find attached a handy little script to patch all the Makefiles
under the src/ (at least for people with gcc and similar versions of
libtool and automake to me -- others will have to patch the patch).

When you compile after patching your makefiles with this you'll have
much less noise output and see output such as:


../../lyx-devel/src/screen.C
3.38u 0.21s 3.83e 93% 1349major

../../lyx-devel/src/sp_spell.C
2.34u 0.16s 2.51e 99% 1269major

in src/ while other subdirs get two time entries.  The first for
g[cc,++] and the second for the shell that libtool was started in.

Linking appears as before in the output partly because it isn't easily
patchable and partly to emphasise when we are doing linking.  Time is
also used for measuring linking.

So what to do with this?

1. Compare std::string to lyxstring compile and link times
2. Be amazed at which files take longest to compile.
        a) attempt to shorten these times
3. Read the compiler error and warning messages more easily
4. Write a parser to ease comparison (build a database or whatever)
   or sort by compile times etc.

Allan. (ARRae)
#!/bin/sh

for i in `find src -name "Makefile" | sed -e s";Makefile;;"` ; do
        pushd $i
cat <<\EOF | patch -l Makefile
17c17
< 
---
> TIME = time -f "%Uu %Ss %ee %P %Fmajor"
77c77
< CC = gcc
---
> CC = $(TIME) gcc
80c80
< CXX = g++
---
> CXX = $(TIME) g++
150c150
< LIBTOOL = $(SHELL) $(top_builddir)/libtool
---
> LIBTOOL = $(TIME) $(SHELL) $(top_builddir)/libtool
446c446,447
<       $(CXXCOMPILE) -c $<
---
>       @echo $<
>       @$(CXXCOMPILE) -c $<
450c451,452
<       $(LTCXXCOMPILE) -c $<
---
>       @echo "$<"
>       @$(LTCXXCOMPILE) -c $<
596,597c598,600
<       @echo '$(LTCOMPILE) -c $<'; \
<       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
---
>       @echo ''
>       @echo '$<'; \
>       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< > /dev/null
606c609,610
<       @echo '$(CXXCOMPILE) -c $<'; \
---
>       @echo ''
>       @echo '$<'; \
615,616c619,621
<       @echo '$(LTCXXCOMPILE) -c $<'; \
<       $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
---
>       @echo ''
>       @echo '$<'; \
>       $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< > /dev/null
EOF
        popd
done

Reply via email to