+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.
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
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
# => 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
# 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],