Was anyone able to resolve this issue? A few weeks
ago I posted about poor bash performance with "while
read" loops. Maybe this is the same issue...
Anyway, I hadn't upgraded my cygwin1.dll for quite a
long time, but when I did, some of my shell scripts
started to have horrible performance. I tracked it
down to the "while read" loops. I wrote the following
benchmark shell script to see how bad the problem
really is. On my PII-333 running Win-ME, I get the
following results:
# time ./doit 1
real 0m3.555s
user 0m0.000s
sys 0m0.000s
# time ./doit 2
real 0m22.870s
user 0m0.000s
sys 0m0.000s
When I run the same benchmark on a linux machine, I
don't get nearly as big a difference between the two
runs.
It would be really great if one of the crack
programmers who work on cygwin could look into this.
I imagine that everyone who uses cygwin would
appreciate a performance boost!
Anyway, here's the benchmark shell script. Thanks.
-Russ
#!/bin/bash
#
# benchmark piping into "while read"
#
# "doit 1" is the "first pass" which benchmarks
# generating output with the nested for-loops
#
# "doit 2" is the "second pass" which adds on the
# "while read" loop
#
# check usage
if test $# -ne 1; then
echo "usage: doit {1|2}"
exit 1
fi
# first pass: generate a bunch of output
for i in 1 2 3 4 5 6 7 8 9 0; do
for j in 1 2 3 4 5 6 7 8 9 0; do
for k in 1 2 3 4 5 6 7 8 9 0; do
for l in 1 2 3 4 5 6 7 8 9 0; do
echo hi
done
done
done
done |
# second pass: the "while read" loop
if test $1 != 2; then
cat - > /dev/null
else
while read JUNK; do
A=1
done
fi