]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Tighten bound of potential speed of m4_append.
authorEric Blake <ebb9@byu.net>
Mon, 14 Jul 2008 16:13:28 +0000 (10:13 -0600)
committerEric Blake <ebb9@byu.net>
Mon, 14 Jul 2008 16:13:28 +0000 (10:13 -0600)
* doc/autoconf.texi (Text processing Macros) <m4_append>
<m4_prepend>: If m4 is fixed, m4_append can be linear rather than
O(n log n).
* lib/m4sugar/m4sugar.m4 (m4_append, m4_append_uniq): Fix comments.
Analysis by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
lib/m4sugar/m4sugar.m4

index 9218ddcc7a5bec5aea5df23a7782b608b11a2397..8ae2ef62cbe8bced8ef316306d76ff717d168d31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-07-14  Eric Blake  <ebb9@byu.net>
+
+       Tighten bound of potential speed of m4_append.
+       * doc/autoconf.texi (Text processing Macros) <m4_append>
+       <m4_prepend>: If m4 is fixed, m4_append can be linear rather than
+       O(n log n).
+       * lib/m4sugar/m4sugar.m4 (m4_append, m4_append_uniq): Fix comments.
+       Analysis by Bruno Haible.
+
 2008-07-11  Eric Blake  <ebb9@byu.net>
 
        Inherit improvements from bison's fork of m4sugar.
index 672e76b6a2c1eea3c1a4e78825f79fc40121494d..a426cd8dde78db01afef0a25a15b994cf2ca6f5b 100644 (file)
@@ -11055,11 +11055,11 @@ to grow strings without duplicating substrings.  Additionally,
 Also, @code{m4_append_uniq} warns if @var{separator} is not empty, but
 occurs within @var{string}, since that can lead to duplicates.
 
-Note that @code{m4_append} can scale @dfn{linearithmically} (ie., O(n
-log n) in complexity notation), depending on the quality of the
-underlying M4 implementation, while @code{m4_append_uniq} has an
-inherent quadratic scaling factor.  If an algorithm can tolerate
-duplicates in the final string, use the former for speed.
+Note that @code{m4_append} can scale linearly in the length of the final
+string, depending on the quality of the underlying M4 implementation,
+while @code{m4_append_uniq} has an inherent quadratic scaling factor.
+If an algorithm can tolerate duplicates in the final string, use the
+former for speed.
 
 @example
 m4_define([active], [ACTIVE])dnl
@@ -11184,7 +11184,7 @@ respectively, except that the @var{string} argument is added at the
 beginning instead of the end of the definition of @code{macro-name}.
 
 Also note that unlike @code{m4_append}, @code{m4_prepend} has quadratic
-rather than linearithmic scaling behavior.  Thus, if the order of list
+rather than linear scaling behavior.  Thus, if the order of list
 elements does not matter, it is better to append.
 @end defmac
 
index 0a708f6f400b8b8a201504592473ccdff7faca73..a4d6f12802f77250b68bcabf646d6f93ef4e9277 100644 (file)
@@ -1923,7 +1923,7 @@ m4_define([m4_combine],
 #    => one, two, three
 #    => [one],[two],[three]
 #
-# Note that m4_append can benefit from amortized O(n log n) m4 behavior, if
+# Note that m4_append can benefit from amortized O(n) m4 behavior, if
 # the underlying m4 implementation is smart enough to avoid copying existing
 # contents when enlarging a macro's definition into any pre-allocated storage
 # (m4 1.4.x unfortunately does not implement this optimization).  m4_prepend
@@ -1947,7 +1947,7 @@ m4_define([m4_prepend],
 # was already present.  Also, warn if SEPARATOR is not empty and occurs
 # within STRING, as the algorithm no longer guarantees uniqueness.
 #
-# Note that while m4_append can be O(n log n) (depending on whether the
+# Note that while m4_append can be O(n) (depending on the quality of the
 # underlying M4 implementation), m4_append_uniq is inherently O(n^2)
 # because each append operation searches the entire string.
 m4_define([m4_append_uniq],