Mail Archives: cygwin/2003/02/08/02:58:10
--------------080205010700040306030705
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Okay, using a more 'fair' metric on speed (don't throw a lot of
'unknowns' at the libid() function; libtool presumably will only present
things that IT believes are libraries or DLLs for identification.
Unless the user mis-specifies something. So, using THIS test routine,
which only grabs .dll.a, .a, .dll, and .exe files:
time for fn in /usr/bin/*.exe /usr/bin/*.dll /usr/lib/*.a ; do
echo $fn : `./cygwin_libid $fn`
done
I get the following results:
Current win32_libid():
real 3m25.480s
user 2m0.436s
sys 1m24.073s
best case, tweaked Ralf script:
real 1m59.535s
user 1m11.151s
sys 0m56.012s
best case, paranoid Chuck script:
real 2m13.261s
user 1m12.385s
sys 0m54.422s
That is, if current is a "100%", then Ralf's is a "58%" and my version
is a "65%".
Here's what the extra 7% execution speed buys you: my version is never
fooled by merely renaming the file. It ALWAYS looks at the actual
content and format of the file itself (or it will follow a symlink and
look at the contents of the target).
How'd I speed it up, while still being paranoid like the original? Try
to spawn as few subsidiary processes as possible. When possible, use
sh's case command for simple regex matching, not grep -E. Reduce one
long chain of pipes and spawned programs to a single (complicated) sed
command. Use 'head' to discard (and not wait for) long extraneous outputs.
Some of these ideas were originally proposed by Ralf, but this version
is sufficiently "mine" that I have no problem sumitting to the libtool
folks.
Ralf -- please drop my 'final' script into one of your generated
libtools and run your tests (what? rebuilding KDE?) on it, and let me
know what you think. (Oh, and since (a) 'file' execution speed is
invariant with target size, and (b) we match *DLL* and *executable*
separately, if you are linking directly to DLLs -- as I believe Ralf's
KDE build does -- then my version is almost as fast (<1% difference) as
Ralf's "check the name of the file only" version)
--Chuck
--------------080205010700040306030705
Content-Type: application/x-java-applet;version=1.1.1;
name="cygwin_libid_orig"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="cygwin_libid_orig"
IyEvYmluL3NoCndpbjMyX2xpYmlkICgpIHsKICB3aW4zMl9saWJpZF90eXBlPSJ1bmtub3du
IgogIGlmIGV2YWwgJE9CSkRVTVAgLWYgJDEgMj4vZGV2L251bGwgfCBcCiAgICAgZ3JlcCAt
RSAnZmlsZSBmb3JtYXQgcGVpKy1pMzg2KC4qYXJjaGl0ZWN0dXJlOiBpMzg2KT8nID4vZGV2
L251bGwgOyB0aGVuCiAgICB3aW4zMl9saWJpZF90eXBlPSJ4ODYgRExMIgogIGVsc2UKICAg
IGlmIGV2YWwgJE9CSkRVTVAgLWYgJDEgMj4vZGV2L251bGwgfCBcCiAgICAgIGdyZXAgLUUg
J2ZpbGUgZm9ybWF0IHBlaSotaTM4NiguKmFyY2hpdGVjdHVyZTogaTM4Nik/JyA+L2Rldi9u
dWxsIDsgdGhlbgogICAgICB3aW4zMl9saWJpZF90eXBlPSJ4ODYiCiAgICAgIGlmIGV2YWwg
ZmlsZSAkMSAyPi9kZXYvbnVsbCB8IFwKICAgICAgICAgZ3JlcCAtRSAnYXIgYXJjaGl2ZScg
Pi9kZXYvbnVsbDsgdGhlbgogICAgICAgIHdpbjMyX2xpYmlkX3R5cGU9IiR3aW4zMl9saWJp
ZF90eXBlIGFyY2hpdmUiCiAgICAgICAgaWYgZXZhbCAkTk0gLWYgcG9zaXggLUEgJDEgfCBh
d2sgJ3twcmludCAkM30nIHwgZ3JlcCAiSSIgPi9kZXYvbnVsbCA7IHRoZW4KICAgICAgICAg
IHdpbjMyX2xpYmlkX3R5cGU9IiR3aW4zMl9saWJpZF90eXBlIGltcG9ydCIKICAgICAgICBl
bHNlCiAgICAgICAgICB3aW4zMl9saWJpZF90eXBlPSIkd2luMzJfbGliaWRfdHlwZSBzdGF0
aWMiCiAgICAgICAgZmkKICAgICAgZmkKICAgIGZpCiAgZmkKICBlY2hvICR3aW4zMl9saWJp
ZF90eXBlCn0KCk9CSkRVTVA9b2JqZHVtcApOTT1ubQp3aW4zMl9saWJpZCAkMQoK
--------------080205010700040306030705
Content-Type: application/x-java-applet;version=1.1.1;
name="cygwin_libid_ralf_tweaked"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="cygwin_libid_ralf_tweaked"
IyEvYmluL3NoCiMgY2hhbmdlczoKIyAgIDEpIG9ubHkgdXNlIG5tIGZvciAuYSBmaWxlcwoj
CndpbjMyX2xpYmlkICgpIHsKICB3aW4zMl9saWJpZF90eXBlPSJ1bmtub3duIgogIGlmIGVj
aG8gJDEgfCBncmVwIC1FICJcLmRsbCR8XC5leGUkIiA+L2Rldi9udWxsOyB0aGVuCiAgICB3
aW4zMl9saWJpZF90eXBlPSJ4ODYgRExMIgogIGVsc2UKICAgIGlmIGVjaG8gJDEgfCBncmVw
IC1FICJcLmRsbC5hJCIgPi9kZXYvbnVsbDsgdGhlbgogICAgICB3aW4zMl9saWJpZF90eXBl
PSJ4ODYgYXJjaGl2ZSBpbXBvcnQiCiAgICBlbHNlCiAgICAgIGlmIGVjaG8gJDEgfCBncmVw
IC1FICJcLmEkIiA+L2Rldi9udWxsOyB0aGVuCiAgICAgICAgaWYgZXZhbCAkTk0gLWYgcG9z
aXggLUEgJDEgfCBoZWFkIC1uIDEwMCB8IGdyZXAgIiBJICIgPi9kZXYvbnVsbCA7IHRoZW4K
ICAgICAgICAgIHdpbjMyX2xpYmlkX3R5cGU9Ing4NiBhcmNoaXZlIGltcG9ydCIKICAgICAg
ICBlbHNlCiAgICAgICAgICB3aW4zMl9saWJpZF90eXBlPSJ4ODYgYXJjaGl2ZSBzdGF0aWMi
CiAgICAgICAgZmkKICAgICAgZmkKICAgIGZpCiAgZmkKICBlY2hvICR3aW4zMl9saWJpZF90
eXBlCn0KCkJKRFVNUD1vYmpkdW1wCk5NPW5tCndpbjMyX2xpYmlkICQxCgoK
--------------080205010700040306030705
Content-Type: application/x-java-applet;version=1.1.1;
name="cygwin_libid_chuck_final"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="cygwin_libid_chuck_final"
IyEvYmluL3NoCndpbjMyX2xpYmlkICgpIHsKICB3aW4zMl9saWJpZF90eXBlPSJ1bmtub3du
IgogIHdpbjMyX2ZpbGVyZXM9YGZpbGUgLUwgJDEgMj4vZGV2L251bGxgCiAgY2FzZSAkd2lu
MzJfZmlsZXJlcyBpbgogICphclwgYXJjaGl2ZSopCiAgICBpZiBldmFsICRPQkpEVU1QIC1m
ICQxIHwgaGVhZCAtbiAxMCAyPi9kZXYvbnVsbCB8IFwKICAgICAgZ3JlcCAtRSAnZmlsZSBm
b3JtYXQgcGUtaTM4NiguKmFyY2hpdGVjdHVyZTogaTM4Nik/JyA+L2Rldi9udWxsIDsgdGhl
bgogICAgICB3aW4zMl9ubXJlcz1gZXZhbCAkTk0gLWYgcG9zaXggLUEgJDEgfCBzZWQgLW4g
LWUgJzEsMTAwey8gSSAve3g7L2ltcG9ydC8he3MvXi9pbXBvcnQvO2g7cDt9O3g7fX0nYAog
ICAgICBpZiBbICJ4JHdpbjMyX25tcmVzIiA9ICJ4aW1wb3J0IiBdIDsgdGhlbgogICAgICAg
IHdpbjMyX2xpYmlkX3R5cGU9Ing4NiBhcmNoaXZlIGltcG9ydCIKICAgICAgZWxzZQogICAg
ICAgIHdpbjMyX2xpYmlkX3R5cGU9Ing4NiBhcmNoaXZlIHN0YXRpYyIKICAgICAgZmkKICAg
IGZpCiAgICA7OwogICpETEwqKSAKICAgIHdpbjMyX2xpYmlkX3R5cGU9Ing4NiBETEwiCiAg
ICA7OwogICpleGVjdXRhYmxlKikgIyBidXQgc2hlbGwgc2NyaXB0cyBhcmUgImV4ZWN1dGFi
bGUiIHRvby4uLgogICAgY2FzZSAkd2luMzJfZmlsZXJlcyBpbgogICAgKk1TXCBXaW5kb3dz
XCBQRVwgSW50ZWwqKQogICAgICB3aW4zMl9saWJpZF90eXBlPSJ4ODYgRExMIgogICAgICA7
OwogICAgZXNhYwogICAgOzsKICBlc2FjCiAgZWNobyAkd2luMzJfbGliaWRfdHlwZQp9CgpP
QkpEVU1QPW9iamR1bXAKTk09bm0Kd2luMzJfbGliaWQgJDEKCg==
--------------080205010700040306030705
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/
--------------080205010700040306030705--
- Raw text -