On Tue, May 19, 2009 at 2:33 AM, Zac Burns <zac...@gmail.com> wrote: > Please explain the case that it would be slower. I'm not sure I > follow. It seems to me that the change would for many people actually > make loading images faster because rather than try each accept > function in succession (in some cases twice over) we take a 'best > guess' approach first, then go to the other functions (once over). The > worst case appears to be one extra check. Best case we go straight for > the correct loader.
Your code pulls in codecs for all programs. That's a *lot* slower for people using only standard file formats (why do you think the init was split up in to parts in the first place?) > About the example, I think it's reversed - WBMP is the one giving the > false positive because it opens the .tga file, which is using targa > compression, as a WBMP. If I have time after work I'll try and figure > out a little more about what is causing this before sending an example > because like I said in the original e-mail it's something about the > context which is causing this - if I simply run the code in a fresh > interpreter it opens as a tga just fine. Looking at the actual code, it's pretty clear that WBMP support shouldn't be enabled by default; that file format has no usable magic code at the beginning of the file (neither has TGA, but at least was their first). I also notice that WBMP is not included in the 1.1.7 code base at all, and it's not listed in the CONTENTS file for 1.1.6; it is present in the windows installer, at least, so this might be a bug in the installer build process... > About the importing of __builtin__, it's a very small speed > improvement - only a couple of milliseconds. Which, is slow enough > that I've started putting all my imports at the top of all files as a > habit - even if it's not a huge difference in this case. This is also > part of the python style guide. A couple of milliseconds? > python -m timeit "import __builtin__" 1000000 loops, best of 3: 1.1 usec per loop Looks like something's wrong with your Python installation. </F> _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig