[PHP-DEV] Speed improvements for GetImageSize? From: Thies C. Arntzen (thies <email protected>)
Date: 10/08/98

hi,
was just truss'ing (solaris equiv for strace) thru some of my pages
(with many jpeg images)....

i use GetImageSize so my tables come up quicker....

i found the following system-calls for every call to GetImageSize:

open("/dot/device/dc_01/dc4/dev/apict/library/iptcpict/iptc/pict/j1998/m10/t08/0002567_0.jpg",
O_RDONLY) = 10
read(10, "FFD8FF", 3) = 3
lseek(10, 2, SEEK_SET) = 2
read(10, "FF", 1) = 1
read(10, "E0", 1) = 1
read(10, "\0", 1) = 1
read(10, "10", 1) = 1
lseek(10, 14, SEEK_CUR) = 20
read(10, "FF", 1) = 1
read(10, "DB", 1) = 1
read(10, "\0", 1) = 1
read(10, " C", 1) = 1
lseek(10, 65, SEEK_CUR) = 89
read(10, "FF", 1) = 1
read(10, "DB", 1) = 1
read(10, "\0", 1) = 1
read(10, " C", 1) = 1
lseek(10, 65, SEEK_CUR) = 158
read(10, "FF", 1) = 1
read(10, "C0", 1) = 1
lseek(10, 3, SEEK_CUR) = 163
read(10, "\0", 1) = 1
read(10, " k", 1) = 1
read(10, "\0", 1) = 1
read(10, "96", 1) = 1
close(10) = 0

(26 calls)

sometimes i have up to 100 "thumbnails" on my pages so we're talking
'bout 2600 system calls just for GetImageSize on that page..

i looked thru the code, and i believe it could be easily changed to use
fopen, fgets... instead of open & read... (and that would bring down our
26 calls to 3 i guess)...

i'm willing to make that modification and submitt the patches, but i'm
not sure if you guys would be willing to integrate that..... if yes,
please drop me a mail, and i will create an diff...

regards,
tc

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>