[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: libjava build times]
From: |
Ralf Wildenhues |
Subject: |
Re: address@hidden: libjava build times] |
Date: |
Fri, 6 May 2005 09:44:34 +0200 |
User-agent: |
Mutt/1.4.1i |
* Joe Buck wrote on Fri, May 06, 2005 at 01:03:14AM CEST:
> On Thu, May 05, 2005 at 11:25:53PM +0200, Ralf Wildenhues wrote:
> > * Albert Chin wrote on Thu, May 05, 2005 at 09:20:50PM CEST:
> > > On Thu, May 05, 2005 at 03:17:26PM +0200, Ralf Wildenhues wrote:
> > > >
> > > > Stuff like
> > > > compile_command="$compile_command $qarg"
> > > > is better written as
> > > > $ECHO " $qarg" >&FD_COMPILE_COMMAND
> > > > compile_command=`$SED 's/^ //' <"$compile_command_file" | $NL2SP`
> > >
> > > Can you explain how the latter is faster? From inspection, I'd believe
> > > the first to be faster.
> >
> > The former scales quadratically with some shells (all I tested on
> > GNU/Linux), presumably because they do repeated reallocs.
>
> Wow. One of my favorite job interview questions is how to implement
> a string class or (for C types) dynamic string library that can grow
> strings without producing quadratic behavior.
Oh well.
> Are you saying that bash fails the test?
GNU bash, version 3.00.14(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.
ash-0.3.8
PD KSH v5.2.14 99/07/13.2
all fail the test, with slightly different crossover times, of course,
but even with constant string addition. I believe zsh does, too, but
have not tested it now.
Regards,
Ralf
Test (uses unportable `seq'):
# --- a.sh ---
a=
: ${n=1000}
for i in `seq 1 $n`
do
a="$a 1"
done