bug-bash
[Top][All Lists]
Advanced

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

Re: libtool 2.4 args parsing incredibly slow


From: Ralf Wildenhues
Subject: Re: libtool 2.4 args parsing incredibly slow
Date: Tue, 1 Feb 2011 20:45:21 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

Hello Chet,

* Chet Ramey wrote on Mon, Jan 31, 2011 at 04:37:32PM CET:
> On 1/30/11 3:50 AM, Ralf Wildenhues wrote:
> >> On Sat, Jan 29, 2011 at 5:58 PM, Chet Ramey wrote:
> >>> On 1/25/11 10:08 PM, Peter O'Gorman wrote:
> >>>>   for lt_wr_arg
> >>>>   do
> >>>>     case \$lt_wr_arg in
> >>>>     --lt-*) ;;
> >>>>     *) set x "$@" "$lt_wr_arg"; shift;;
> >>>>     esac
> >>>>     shift
> >>>>   done
> > 
> >>> This is a terribly inefficient function.
> > 
> > Only if bash implements it inefficiently.  It doesn't have to scale
> > nonlinearly with an efficient shell implementation that special-cases
> > this idiom which is, by the way, used quite a bit in Posix shell
> > scripts.
> 
> If it's as common as you claim, it might be worth special-casing.  The
> question is whether that's the case, and whether it's invoked with
> thousands of arguments enough to make the extra bookkeeping worthwhile.

Well, the idiom is used in install-sh.  Without a loop around it, it is
also used in the libtool and compile scripts.  The former two are used
fairly heavily in many packages built by autotools (install-sh mostly on
non-GNU systems).  Recent Automake feeds around 40 arguments to
install-sh, which I did both to avoid nonlinear effects and because
using xargs to work around command line length limitations leads to less
reproducible results ($INSTALL a b ... a d/ causes some install programs
to error out, and files may have been listed more than once
inadvertently, which you don't want to find out after shipping).
libtool scripts can get passed very many arguments when linking, which,
IIRC, prompted += being implemented.

Now, this is all handwaving, but if you can get a single
  set x "$@" "$arg"
  shift

to scale sublinearly, then I think it would be worth trying.

If you'd like non-handwaving arguments, then please specify what kind of
measurement you would like to see.

Thanks,
Ralf



reply via email to

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