autoconf-patches
[Top][All Lists]
Advanced

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

[Paolo Bonzini] [PATCH] Speedup creation of configure.lineno


From: Alexandre Duret-Lutz
Subject: [Paolo Bonzini] [PATCH] Speedup creation of configure.lineno
Date: Sun, 04 Jan 2004 12:40:29 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Message-ID: <address@hidden>
From: "Paolo Bonzini" <address@hidden>
To: "Alexandre Duret-Lutz" <address@hidden>
References: <address@hidden> <address@hidden>
Subject: Re: [PATCH] Speedup creation of configure.lineno
Date: Sun, 4 Jan 2004 09:48:32 +0100

> Happy new year Paolo

Happy new year!

>  Paolo> The attached patch modifies the sed scripts to be 4
>  Paolo> times faster than those in the current autoconf.
> 
> You forgot to attach it.

Sorry, here it is.

diff -ru3 autoconf-save/lib/m4sugar/m4sh.m4 autoconf/lib/m4sugar/m4sh.m4
--- autoconf-save/lib/m4sugar/m4sh.m4   2004-01-03 14:46:16.000000000 +0100
+++ autoconf/lib/m4sugar/m4sh.m4        2004-01-03 14:43:36.000000000 +0100
@@ -575,22 +575,24 @@
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
   # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
-    sed '
-      N
-      s,$,-,
-      : loop
-      
s,^\([['$as_cr_digits']]*\)\(.*\)[[$]]LINENO\([[^'$as_cr_alnum'_]]\),\1\2\1\3,
-      t loop
-      s,-$,,
-      s,^[['$as_cr_digits']]*\n,,
-    ' >$as_me.lineno &&
+  sed -n 'p
+         /$LINENO/=' <$as_myself |
+    sed 's/$LINENO.*/&-/
+        tok
+        b
+        :ok
+        N
+        :loop
+        s,$LINENO\([[^'$as_cr_alnum'_]]\)\([[^\n]]*\n\)\(.*\),\3\1\2\3,
+        tloop
+        s,-\n.*$,, ' >$as_me.lineno &&
   chmod +x $as_me.lineno ||
     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
 

reply via email to

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