From: Stefano Lattarini Date: Fri, 4 May 2012 00:26:30 +0000 (+0200) Subject: [ng] dist: optimize calculation of list of distributed file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a44fd52927c1e25b0572154004fb6455b93bf0e6;p=thirdparty%2Fautomake.git [ng] dist: optimize calculation of list of distributed file Our implementation of the $(am__uniq) make function is slow as hell when applied to big lists. Since that function is used to (re)calculate the list of distributed files, its inefficiency reflects on *every* run of a Makefile generated by Automake which distributes a lot of files. For example, a null build of the Automake tree now takes 20 seconds (!) on my Debian system, while earlier it was practically instantaneous (less than half a second). Luckily, the GNU make manual documents that the $(sort) built-in also strip duplicates from the sorted list. Since we don't care about the order of the distributed files (or directories thereof), we can use $(sort ...) instead of $(call am__uniq, ...), and live happily. * lib/am/distdir.am (am__dist_files)_: Uniqify content using '$(sort)', not '$(am__uniq)'. (am__dist_parent_dirs): Likewise. Signed-off-by: Stefano Lattarini --- diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 273b4d6fb..face03ad0 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -14,8 +14,10 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -am__dist_files = $(call am__uniq, \ - $(am__dist_common) $(am__dist_sources) $(TEXINFOS) $(EXTRA_DIST)) +## Use 'sort', not 'am__uniq', for performance reasons. Luckily, we +## don't care in which order the distributed files are. +am__dist_files = $(strip $(sort \ + $(am__dist_common) $(am__dist_sources) $(TEXINFOS) $(EXTRA_DIST))) ## Try to avoid repeated slashed in the entries, to make the ## filtering in the 'am__dist_files_1' definition below more reliable. @@ -59,8 +61,8 @@ am__dist_files_cooked = $(strip $(am__dist_files_2)) ## will allow our rules to correctly create "$(distdir)/subdir", and not ## "$(distdir)/$(srcdir)/subdir" -- which, in a VPATH build where ## "$(subdir) = ..", would be the build directory! -am__dist_parent_dirs = $(call am__uniq, \ - $(filter-out ., $(patsubst ./%,%,$(dir $(am__dist_files_cooked))))) +am__dist_parent_dirs = $(strip $(sort \ + $(filter-out ., $(patsubst ./%,%,$(dir $(am__dist_files_cooked)))))) if %?TOPDIR_P% distdir = $(PACKAGE)-$(VERSION)