autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

autotest speedups


From: Eric Blake
Subject: autotest speedups
Date: Thu, 04 Oct 2007 07:15:00 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

And so it begins.  When compiling autoconf's tests/testsuite, we were
doing more than 7000 regex compilations just to determine the basename of
the current file; after this patch, only 24.

2007-10-04  Eric Blake  <address@hidden>

        Speed up building testsuites.
        * lib/autotest/general.m4 (AT_LINE): Only use regex when file
        changed since last time.  Use simpler regex.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHBOdT84KuGfSFAYARAvp3AJ9WXKKg3DZ+kbLCo3905k0Yd05AnwCgsJeu
Re6lWQftJWgUtrFLaHfD0E4=
=2B5m
-----END PGP SIGNATURE-----
>From 4c7d289c7d87cea66ca4dceef5c7d4f19feac91e Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 4 Oct 2007 07:13:50 -0600
Subject: [PATCH] Speed up building testsuites.

* lib/autotest/general.m4 (AT_LINE): Only use regex when file
changed since last time.  Use simpler regex.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |    6 ++++++
 lib/autotest/general.m4 |   13 ++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 40d3fb8..b98cf3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-04  Eric Blake  <address@hidden>
+
+       Speed up building testsuites.
+       * lib/autotest/general.m4 (AT_LINE): Only use regex when file
+       changed since last time.  Use simpler regex.
+
 2007-10-03  Eric Blake  <address@hidden>
 
        Optimize checking for identifiers.
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index a0de285..ac41c14 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -142,8 +142,19 @@ m4_define([_m4_divert(TEST_SCRIPT)],        403)
 # is one of the biggest junk in the whole universe wrt regexp, don't
 # even think about using `?' or `\?'.  Bah, `*' will do.
 # Pleeeeeeeease, Gary, provide us with dirname and ERE!
+#
+# M4 recompiles the regular expression for every m4_bpatsubst, but __file__
+# rarely changes.  Be fast - only compute the dirname when necessary; for
+# autoconf alone, this shaves off several seconds in building testsuite.
+m4_define([_AT_LINE_file])
+m4_define([_AT_LINE_base])
 m4_define([AT_LINE],
-[m4_bpatsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
+[m4_if(m4_defn([_AT_LINE_file]), __file__, [],
+       [m4_do([m4_define([_AT_LINE_file], __file__)],
+             [m4_define([_AT_LINE_base],
+                        m4_bpatsubst(/__file__, [/\([^/]*\)$],
+                                     [[\1]]))])])dnl
+m4_defn([_AT_LINE_base]):__line__])
 
 
 # _AT_NORMALIZE_TEST_GROUP_NUMBER(SHELL-VAR)
-- 
1.5.3.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]