Issue 3424: imghdr test order makes it slow
Created on 2008-07-22 09:30 by biny, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| current | biny, 2008-07-23 05:38 | Unoptimized | ||
| optimized | biny, 2008-07-23 05:38 | optimized | ||
| Messages (6) | |||
|---|---|---|---|
| msg70142 - (view) | Author: Ilpo Nyyssönen (biny) | Date: 2008-07-22 09:30 | |
The order of tests in imghdr makes it slow in common cases. Even without any statistics it is quite easy to see that jpeg is the most common format. In imghdr only bmp and png are after it. Also, should png really be the last one? Nearly all digital cameras produce jpegs and handling such images is one big use case for this module. Changing the test order should be easy and have big effect in common use cases. |
|||
| msg70146 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-22 12:36 | |
Do you have any benchmarks to prove this with? IMO, the difference would be extremely insignificant. |
|||
| msg70168 - (view) | Author: Ilpo Nyyssönen (biny) | Date: 2008-07-23 05:38 | |
Naturally it requires a big amount of files. Getting big amount of jpegs is easy. Getting big amount of pbms or rgbs is not so easy. I'll attach two profiling runs showing some difference when test_jpeg and test_exif are moved to be the first tests. The beginnings those outputs show the return value counts. |
|||
| msg70507 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-31 14:27 | |
Ok. Would you like to propose an alternate order? |
|||
| msg70649 - (view) | Author: Ilpo Nyyssönen (biny) | Date: 2008-08-03 05:24 | |
jpeg exif png gif tiff and then the rest |
|||
| msg71224 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-08-16 16:29 | |
Done in r65713. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:36 | admin | set | github: 47674 |
| 2008-08-16 16:29:28 | benjamin.peterson | set | status: open -> closed resolution: accepted messages: + msg71224 |
| 2008-08-03 05:24:48 | biny | set | messages: + msg70649 |
| 2008-07-31 14:27:29 | benjamin.peterson | set | status: pending -> open messages: + msg70507 |
| 2008-07-23 05:38:56 | biny | set | files: + optimized |
| 2008-07-23 05:38:17 | biny | set | files:
+ current messages: + msg70168 |
| 2008-07-22 12:36:39 | benjamin.peterson | set | status: open -> pending nosy: + benjamin.peterson messages: + msg70146 |
| 2008-07-22 09:30:38 | biny | create | |
