theme_image() and theme_image_style() access the filesystem. This is really terrible for performance.
Every time theme_image() is called, by default it will check that the file to be served actually exists and, if so, goes on to read the file to determine the width and height attributes for the tag.
This is incredibly bad for performance and is something that theme_image() should not be capable of doing. If the filesystem is mounted over the network or the file is in the cloud then it will be immensely worse.
If the code calling theme_image() isn't smart enough to know the dimensions of the image, then it should be left up to the web browser to determine.
Many functions in core set $variables['getsize'] to FALSE to prevent this from happening, but it should never happen at all. Its a really bad practice.
theme_image_style() always checks if the file exists - its not necessary.
PASSED: [[SimpleTest]]: [MySQL] 29,400 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 31,602 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 31,610 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 31,488 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch hardcode-image-dimensions.patch. View