make clean is slow

View: New views
4 Messages — Rating Filter:   Alert me  

make clean is slow

by Bob Friesenhahn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I find that 'make clean' is annoyingly slow.  For my package 'make
clean' takes more than 1/10 of the optimized build time even though I
am using a very fast disk subsystem.  For the clean target, Automake
produces many chunks which are of the form:

clean-codersLTLIBRARIES:
         -test -z "$(coders_LTLIBRARIES)" || rm -f $(coders_LTLIBRARIES)
         @list='$(coders_LTLIBRARIES)'; for p in $$list; do \
           dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
           test "$$dir" != "$$p" || dir=.; \
           echo "rm -f \"$${dir}/so_locations\""; \
           rm -f "$${dir}/so_locations"; \
         done

or

clean-binPROGRAMS:
         @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
         echo " rm -f" $$list; \
         rm -f $$list || exit $$?; \
         test -n "$(EXEEXT)" || exit 0; \
         list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
         echo " rm -f" $$list; \
         rm -f $$list

Is there a way to make this quite a lot faster?

Thanks,

Bob
--
Bob Friesenhahn
bfriesen@..., http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/



Re: make clean is slow

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bob,

* Bob Friesenhahn wrote on Wed, Oct 21, 2009 at 10:03:41PM CEST:

> clean-codersLTLIBRARIES:
>         -test -z "$(coders_LTLIBRARIES)" || rm -f $(coders_LTLIBRARIES)
>         @list='$(coders_LTLIBRARIES)'; for p in $$list; do \
>           dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
>           test "$$dir" != "$$p" || dir=.; \
>           echo "rm -f \"$${dir}/so_locations\""; \
>           rm -f "$${dir}/so_locations"; \
>         done
>
> or
>
> clean-binPROGRAMS:
>         @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
>         echo " rm -f" $$list; \
>         rm -f $$list || exit $$?; \
>         test -n "$(EXEEXT)" || exit 0; \
>         list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
>         echo " rm -f" $$list; \
>         rm -f $$list
>
> Is there a way to make this quite a lot faster?

The LTLIBRARIES bits: yes, noted.  The PROGRAMS bits should be
reasonably fast already, only forking a constant number of times.

Thanks,
Ralf



Re: make clean is slow

by Bob Friesenhahn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 21 Oct 2009, Ralf Wildenhues wrote:
>>
>> Is there a way to make this quite a lot faster?
>
> The LTLIBRARIES bits: yes, noted.  The PROGRAMS bits should be
> reasonably fast already, only forking a constant number of times.

While clean is running, it is clear that the libraries bit is taking
most of the time.  My package has quite a lot of these files to
remove, and the sequential nature of the removal process causes it to
be rather slow.

The time to clean my package depends quite a lot on the OS:

FreeBSD: 1.512
OS-X Leopard: 3.575
Solaris 10: 4.339
Linux (under Solaris VirtualBox): 4.299
MinGW: 6.656

For some of the OSs the time is about the same if the directory is
already cleaned, while for others (e.g. OS-X) the time improves
considerably if the directory is already clean.

Usually I don't care much about 'make clean' times but when I am
chasing down compilation warnings I tend to do a lot of cleans.

Bob
--
Bob Friesenhahn
bfriesen@..., http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/



Re: make clean is slow

by Ben Pfaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Friesenhahn <bfriesen@...> writes:

> Usually I don't care much about 'make clean' times but when I am
> chasing down compilation warnings I tend to do a lot of cleans.

When I'm chasing down compilation warnings I usually turn on
"-Werror" temporarily.  Saves a lot of time.
--
Ben Pfaff
http://benpfaff.org