[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-ng] [PATCH 4/4] [ng] dist: optimize calculation of list of dis
From: |
Stefano Lattarini |
Subject: |
[Automake-ng] [PATCH 4/4] [ng] dist: optimize calculation of list of distributed file |
Date: |
Sun, 6 May 2012 18:35:30 +0200 |
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 file. 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 <address@hidden>
---
lib/am/distdir.am | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 273b4d6..face03a 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 <http://www.gnu.org/licenses/>.
-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)
--
1.7.9.5