]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Speed ups.
authorAkim Demaille <akim@epita.fr>
Tue, 21 Mar 2000 12:09:31 +0000 (12:09 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 21 Mar 2000 12:09:31 +0000 (12:09 +0000)
* libm4.m4 (m4_append, m4_list_append): Use m4_define, not define.
On my machine the former implementation takes 4mn 40s to run the
test suite.  Using m4_define leads to 4mn 15s.
* acgeneral.m4 (_AC_SUBST): Use AC_EXPAND_ONCE (which uses
m4_define, not define).  4mn.
(_AC_DIVERT): Don't use m4_case.  Starting from those 4mn, if you
just move NORMAL* first in m4_case, the test suite is run in 3mn.
If instead of using m4, you use an `associative array' plus a
wrapper (current implementation), it falls to 2mn.

ChangeLog
acgeneral.m4
lib/autoconf/general.m4
libm4.m4

index cbf89ddd59ccd3249e4ca622483d4344dad3bb2c..3e679432e7bb20b81a0ed85bdcce8e087cbe8f1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2000-03-21  Akim Demaille  <akim@epita.fr>
+
+       Speed ups.
+
+       * libm4.m4 (m4_append, m4_list_append): Use m4_define, not define.
+       On my machine the former implementation takes 4mn 40s to run the
+       test suite.  Using m4_define leads to 4mn 15s.
+       * acgeneral.m4 (_AC_SUBST): Use AC_EXPAND_ONCE (which uses
+       m4_define, not define).  4mn.
+       (_AC_DIVERT): Don't use m4_case.  Starting from those 4mn, if you
+       just move NORMAL* first in m4_case, the test suite is run in 3mn.
+       If instead of using m4, you use an `associative array' plus a
+       wrapper (current implementation), it falls to 2mn.
+
 2000-03-21  Akim Demaille  <akim@epita.fr>
 
        * tests/tools.m4 (autoconf --trace): New test.
index 2fd84613bb3ce7c68d5cac83ef170976fdb3b0b9..11d9b72ed103fddad625ae805768f2aea7007b29 100644 (file)
@@ -111,30 +111,33 @@ m4_namespace_push(autoconf)
 # --------------------------
 # Convert a diversion name into its number.  Otherwise, return
 # DIVERSION-NAME which is supposed to be an actual diversion number.
+# Of course it would be nicer to use m4_case here, instead of zillions
+# of little macros, but it then takes twice longer to run `autoconf'!
+define([_AC_DIVERT(KILL)],           -1)
+
+define([_AC_DIVERT(BINSH)],           0)
+define([_AC_DIVERT(NOTICE)],          1)
+define([_AC_DIVERT(DEFAULTS)],        2)
+define([_AC_DIVERT(INIT_PARSE_ARGS)], 3)
+define([_AC_DIVERT(HELP_BEGIN)],      4)
+define([_AC_DIVERT(HELP_ENABLE)],     5)
+define([_AC_DIVERT(HELP_WITH)],       6)
+define([_AC_DIVERT(HELP_VAR)],        7)
+define([_AC_DIVERT(HELP_END)],        8)
+define([_AC_DIVERT(VERSION_BEGIN)],   9)
+define([_AC_DIVERT(VERSION_END)],    10)
+define([_AC_DIVERT(INIT_PREPARE)],   11)
+
+define([_AC_DIVERT(NORMAL_4)],       20)
+define([_AC_DIVERT(NORMAL_3)],       21)
+define([_AC_DIVERT(NORMAL_2)],       22)
+define([_AC_DIVERT(NORMAL_1)],       23)
+define([_AC_DIVERT(NORMAL)],         24)
+
 define([_AC_DIVERT],
-[m4_case([$1],
-         [KILL],           -1,
-
-         [BINSH],           0,
-         [NOTICE],          1,
-         [DEFAULTS],        2,
-         [INIT_PARSE_ARGS], 3,
-         [HELP_BEGIN],      4,
-         [HELP_ENABLE],     5,
-         [HELP_WITH],       6,
-         [HELP_VAR],        7,
-         [HELP_END],        8,
-         [VERSION_BEGIN],   9,
-         [VERSION_END],    10,
-         [INIT_PREPARE],   11,
-
-         [NORMAL_4],       20,
-         [NORMAL_3],       21,
-         [NORMAL_2],       22,
-         [NORMAL_1],       23,
-         [NORMAL],         24,
-
-         [$1])])
+[ifdef([_AC_DIVERT($1)],
+       [indir([_AC_DIVERT($1)])],
+       [$1])])
 
 
 # AC_DIVERT_PUSH(DIVERSION-NAME)
@@ -1895,11 +1898,10 @@ EOF
 # If VARIABLE has not already been AC_SUBST'ed, append the sed PROGRAM
 # to `_AC_SUBST_SED_PROGRAM'.
 define(_AC_SUBST,
-[ifdef([AC_SUBST($1)], [],
-[define([AC_SUBST($1)])dnl
-m4_append([_AC_SUBST_SED_PROGRAM],
+[AC_EXPAND_ONCE([m4_append([_AC_SUBST_SED_PROGRAM],
 [$2
-])])])
+])])dnl
+])
 
 # Initialize.
 define([_AC_SUBST_SED_PROGRAM])
index 2fd84613bb3ce7c68d5cac83ef170976fdb3b0b9..11d9b72ed103fddad625ae805768f2aea7007b29 100644 (file)
@@ -111,30 +111,33 @@ m4_namespace_push(autoconf)
 # --------------------------
 # Convert a diversion name into its number.  Otherwise, return
 # DIVERSION-NAME which is supposed to be an actual diversion number.
+# Of course it would be nicer to use m4_case here, instead of zillions
+# of little macros, but it then takes twice longer to run `autoconf'!
+define([_AC_DIVERT(KILL)],           -1)
+
+define([_AC_DIVERT(BINSH)],           0)
+define([_AC_DIVERT(NOTICE)],          1)
+define([_AC_DIVERT(DEFAULTS)],        2)
+define([_AC_DIVERT(INIT_PARSE_ARGS)], 3)
+define([_AC_DIVERT(HELP_BEGIN)],      4)
+define([_AC_DIVERT(HELP_ENABLE)],     5)
+define([_AC_DIVERT(HELP_WITH)],       6)
+define([_AC_DIVERT(HELP_VAR)],        7)
+define([_AC_DIVERT(HELP_END)],        8)
+define([_AC_DIVERT(VERSION_BEGIN)],   9)
+define([_AC_DIVERT(VERSION_END)],    10)
+define([_AC_DIVERT(INIT_PREPARE)],   11)
+
+define([_AC_DIVERT(NORMAL_4)],       20)
+define([_AC_DIVERT(NORMAL_3)],       21)
+define([_AC_DIVERT(NORMAL_2)],       22)
+define([_AC_DIVERT(NORMAL_1)],       23)
+define([_AC_DIVERT(NORMAL)],         24)
+
 define([_AC_DIVERT],
-[m4_case([$1],
-         [KILL],           -1,
-
-         [BINSH],           0,
-         [NOTICE],          1,
-         [DEFAULTS],        2,
-         [INIT_PARSE_ARGS], 3,
-         [HELP_BEGIN],      4,
-         [HELP_ENABLE],     5,
-         [HELP_WITH],       6,
-         [HELP_VAR],        7,
-         [HELP_END],        8,
-         [VERSION_BEGIN],   9,
-         [VERSION_END],    10,
-         [INIT_PREPARE],   11,
-
-         [NORMAL_4],       20,
-         [NORMAL_3],       21,
-         [NORMAL_2],       22,
-         [NORMAL_1],       23,
-         [NORMAL],         24,
-
-         [$1])])
+[ifdef([_AC_DIVERT($1)],
+       [indir([_AC_DIVERT($1)])],
+       [$1])])
 
 
 # AC_DIVERT_PUSH(DIVERSION-NAME)
@@ -1895,11 +1898,10 @@ EOF
 # If VARIABLE has not already been AC_SUBST'ed, append the sed PROGRAM
 # to `_AC_SUBST_SED_PROGRAM'.
 define(_AC_SUBST,
-[ifdef([AC_SUBST($1)], [],
-[define([AC_SUBST($1)])dnl
-m4_append([_AC_SUBST_SED_PROGRAM],
+[AC_EXPAND_ONCE([m4_append([_AC_SUBST_SED_PROGRAM],
 [$2
-])])])
+])])dnl
+])
 
 # Initialize.
 define([_AC_SUBST_SED_PROGRAM])
index b67a88df8504a52884696786e38b18c397722b8b..19d9881bf2b3c625d2cc7e9353889b3309b0f058 100644 (file)
--- a/libm4.m4
+++ b/libm4.m4
@@ -634,7 +634,7 @@ define([m4_strip],
 #    =>
 #    => active
 define(m4_append,
-[define([$1],
+[m4_define([$1],
 ifdef([$1], [defn([$1])])[$2])])
 
 
@@ -642,7 +642,7 @@ ifdef([$1], [defn([$1])])[$2])])
 # ----------------------------------
 # Same as `m4_append', but each element is separated by `, '.
 define(m4_list_append,
-[define([$1],
+[m4_define([$1],
 ifdef([$1], [defn([$1]), ])[$2])])