autoconf-patches
[Top][All Lists]
Advanced

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

Re: Fix m4_join


From: Ralf Wildenhues
Subject: Re: Fix m4_join
Date: Mon, 15 Oct 2007 19:14:09 +0200
User-agent: Mutt/1.5.16 (2007-10-11)

Hi Eric,

* Eric Blake wrote on Mon, Oct 15, 2007 at 03:03:56PM CEST:
> According to Ralf Wildenhues on 10/15/2007 12:15 AM:
> > 
> > Producing a comma-separated list of items; for readability and line
> > length limits, the separator should probably be comma plus newline.
> 
> m4_define([mysep], [[,]m4_newline])
> m4_join(mysep, [one], [two], [three])

Thank you!  That's good.  Now it would be even better if m4_join were
efficient in that it would not scale quadratically:

m4_join([:
], m4_for([i], 1, 1000, [], [i,]))

# for 1000, 2000, and 4000 iterations:
$ \time ../build/tests/autoconf

0.82user 0.14system 0:00.97elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+28481minor)pagefaults 0swaps

3.46user 0.17system 0:03.64elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+33979minor)pagefaults 0swaps

13.99user 0.32system 0:14.30elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+55341minor)pagefaults 0swaps

While Libtool uses only some 50 arguments, but due to their size, it
still takes a long time.  In the Libtool case, I don't care whether we
use m4_join at all, just that the loops over the libtool variables do
not scale quadratically.  At least the current code doesn't scale
cubically any more, which it did before, IIRC.  m4_map_sep seems to be
quadratic, too.

Cheers,
Ralf




reply via email to

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