From: Martijn F. <fa...@ve...> - 2000-04-19 18:17:53
|
Eric Jacobs wrote: > > > Loading from strings directly doesn't seem necessary to me either; you can > > easily use StringIO or cStringIO to wrap the string up as a file-like > > object after all? > > Yes. > > I included that solely on account of performance, not functionality. I've > been doing some cursory testing; it seems that for large images (I used a > 62k 800x600 RGB PNG) it takes roughly the same amount of time whichever > method you load it with, from MetaKit or from the filesystem. But with > small images (an assortment of PNGs from 100 bytes to about 2K), I found > that MetaKit can approach the performance of the filesystem, but only > by loading the image as a string; the amount of data used constructing and > deconstructing wrappers was high relative to the actual amount of image > data being transferred. What about wrapping cStringIO around the string? Have you tried that? > The function overloading is ugly but necessary in this case, especially as > more functions are implemented that use SDL_RWops. I would hate to see the > size of the API mushroom as little functions are multiplied to cover every > little case. I'm still not convinced we can't simply accept the slower option if that makes the API more clean. That's generally the Python approach, after all. Hopefully soon I'll get some time to study all this myself, though. :) Regards, Martijn |