From: Akim Demaille Date: Fri, 28 Apr 2000 09:46:55 +0000 (+0000) Subject: mawk suffers a severe performance loss when using `sub' with a X-Git-Tag: autoconf-2.50~957 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2df476bb0c9b56c8c9fcf164188422ed0d881f0a;p=thirdparty%2Fautoconf.git mawk suffers a severe performance loss when using `sub' with a changing value. On the `configure' script of the fileutils: mawk '{ sub (/foo/, foo++) }' -> 14s. mawk '{ if ($0 ~ /foo/) sub (/foo/, foo++) }' -> 0.03s. mawk '{ sub (/foo/, foo) }' -> 0.03s. * autoconf.sh (task script, AWK script): Run `sub (__oline__, oline)' only in the lines that match `__oline__'. Suggested by Paul Eggert. --- diff --git a/ChangeLog b/ChangeLog index 79e153173..173933bb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-04-28 Akim Demaille + + mawk suffers a severe performance loss when using `sub' with a + changing value. On the `configure' script of the fileutils: + mawk '{ sub (/foo/, foo++) }' -> 14s. + mawk '{ if ($0 ~ /foo/) sub (/foo/, foo++) }' -> 0.03s. + mawk '{ sub (/foo/, foo) }' -> 0.03s. + + * autoconf.sh (task script, AWK script): Run `sub (__oline__, + oline)' only in the lines that match `__oline__'. + Suggested by Paul Eggert. + 2000-04-28 Akim Demaille * autoconf.sh (options handling::-W*): Strip two leading chars, not diff --git a/autoconf.in b/autoconf.in index d5e296e33..db19c30e1 100644 --- a/autoconf.in +++ b/autoconf.in @@ -308,8 +308,9 @@ case $task in } duplicate = 0 oline++ - while (sub(/__oline__/, oline)) - continue + if ($0 ~ /__oline__/) + while (sub(/__oline__/, oline)) + continue while (sub(/@<:@/, "[")) continue while (sub(/@:>@/, "]")) diff --git a/autoconf.sh b/autoconf.sh index d5e296e33..db19c30e1 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -308,8 +308,9 @@ case $task in } duplicate = 0 oline++ - while (sub(/__oline__/, oline)) - continue + if ($0 ~ /__oline__/) + while (sub(/__oline__/, oline)) + continue while (sub(/@<:@/, "[")) continue while (sub(/@:>@/, "]")) diff --git a/bin/autoconf.in b/bin/autoconf.in index d5e296e33..db19c30e1 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -308,8 +308,9 @@ case $task in } duplicate = 0 oline++ - while (sub(/__oline__/, oline)) - continue + if ($0 ~ /__oline__/) + while (sub(/__oline__/, oline)) + continue while (sub(/@<:@/, "[")) continue while (sub(/@:>@/, "]"))