Mail Archives: cygwin/2002/05/15/04:09:22
--0-1888884628-1021449842=:66321
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
I hadn't upgraded my cygwin installation for nine
months or so, and when I did, I started having a
peculiar performance problem with one of my shell
scripts. When you pipe into a "while read xxx; do"
loop, it's very slow. I wrote a little benchmark
shell script to help me validate this belief, and it's
attached.
When I time it with just a bunch of nested "for"
loops, I get the following results:
# time ./doit 1
real 0m2.544s
user 0m0.000s
sys 0m0.000s
When I time it by piping the nested "for" loops into a
"while read" loop, I get the following results:
# time ./doit 2
real 0m22.855s
user 0m0.000s
sys 0m0.000s
As you can see, the "while read" loop seems to have
pitiful performance.
I changed the first line to "#!/bin/bash" to make sure
it wasn't specific to sh as opposed to bash, with the
same results.
I ran the "bash" version of the same benchmark script
on a linux box (basically same version of bash), and
the time doubled between the two passes, which is
pretty much what you would expect, so this seems to be
something in cygwin, not specific to the shell.
Anybody have any idea what's wrong, and how it might
be fixed?
Thanks.
-Russ
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--0-1888884628-1021449842=:66321
Content-Type: application/x-unknown; name=doit
Content-Transfer-Encoding: base64
Content-Description: doit
Content-Disposition: attachment; filename=doit
IyEvYmluL3NoCgojCiMgYmVuY2htYXJrIHBpcGluZyBpbnRvICJ3aGlsZSBy
ZWFkIgojCiMgImRvaXQgMSIgaXMgdGhlICJmaXJzdCBwYXNzIiB3aGljaCBi
ZW5jaG1hcmtzIGdlbmVyYXRpbmcgb3V0cHV0IHdpdGggdGhlCiMJbmVzdGVk
IGZvci1sb29wcwojCiMgImRvaXQgMiIgaXMgdGhlICJzZWNvbmQgcGFzcyIg
d2hpY2ggYWRkcyBvbiB0aGUgIndoaWxlIHJlYWQiIGxvb3AKIwoKIyBjaGVj
ayB1c2FnZQppZiB0ZXN0ICQjIC1uZSAxOyB0aGVuCiAgICBlY2hvICJ1c2Fn
ZTogZG9pdCB7MXwyfSIKICAgIGV4aXQgMQpmaQoKIyBmaXJzdCBwYXNzOiBn
ZW5lcmF0ZSBhIGJ1bmNoIG9mIG91dHB1dApmb3IgaSBpbiAxIDIgMyA0IDUg
NiA3IDggOSAwOyBkbwogICAgZm9yIGogaW4gMSAyIDMgNCA1IDYgNyA4IDkg
MDsgZG8KCWZvciBrIGluIDEgMiAzIDQgNSA2IDcgOCA5IDA7IGRvCgkgICAg
Zm9yIGwgaW4gMSAyIDMgNCA1IDYgNyA4IDkgMDsgZG8KCQllY2hvIGhpCgkg
ICAgZG9uZQoJZG9uZQogICAgZG9uZQpkb25lIHwKCiMgc2Vjb25kIHBhc3M6
IHRoZSAid2hpbGUgcmVhZCIgbG9vcAppZiB0ZXN0ICQxICE9IDI7IHRoZW4K
ICAgIGNhdCAtID4gL2Rldi9udWxsCmVsc2UKICAgIHdoaWxlIHJlYWQgSlVO
SzsgZG8KCUE9MQogICAgZG9uZQpmaQo=
--0-1888884628-1021449842=:66321
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--0-1888884628-1021449842=:66321--
- Raw text -