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.
This commit is contained in:
Akim Demaille 2000-03-21 12:09:31 +00:00
parent 41f6c57a3e
commit 1a1ee72ec1
4 changed files with 74 additions and 56 deletions

View File

@ -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.

View 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])

View 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])

View File

@ -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])])