[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libtool 2.4 args parsing incredibly slow
From: |
Peter O'Gorman |
Subject: |
Re: libtool 2.4 args parsing incredibly slow |
Date: |
Tue, 25 Jan 2011 21:08:57 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc13 Thunderbird/3.1.7 |
Hi,
Dan reported a libtool performance regression in libtool-2.4 when
running his binaries with a large number of arguments.
Libtool creates a shell script which usually sets some env vars and runs
the binary, new in recent libtool, the script also takes arguments, so
these have to be removed when execing the binary.
Because forking is usually quite expensive, this shell function avoids
forks:
func_exec_program ()
{
for lt_wr_arg
do
case \$lt_wr_arg in
--lt-*) ;;
*) set x "$@" "$lt_wr_arg"; shift;;
esac
shift
done
func_exec_program_core ${1+"$@"}
}
Turns out that bash is relatively slow here, even with a simpler loop:
for arg
do
echo "$@" >/dev/null
done
$ time bash ./s.sh `seq 1 1000`
real 0m9.866s
user 0m8.104s
sys 0m0.088s
$ time dash ./s.sh `seq 1 1000`
real 0m0.571s
user 0m0.355s
sys 0m0.097s
$ time zsh ./s.sh `seq 1 1000`
real 0m0.770s
user 0m0.541s
sys 0m0.079s
I have not investigated what the other shells are not doing that bash is
doing here, it's entirely possible that they're buggy in some way that
bash isn't.
We'll try to fix libtool to not cause this problem too, of course.
Thanks,
Peter
- Re: libtool 2.4 args parsing incredibly slow,
Peter O'Gorman <=