| Summary: | Windows SDL_RWread slowdown in 1.2.10/11 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ryan C. Gordon <icculus> |
| Component: | file | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P1 | ||
| Version: | 1.2.10 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
| URL: | http://lists.libsdl.org/pipermail/sdl-libsdl.org/2007-March/060293.html | ||
|
Description
Ryan C. Gordon
2007-03-08 14:58:45 UTC
Bumping a bunch of bugs to Priority 1 for consideration for the 1.2.12 release. --ryan. Wacky, I'm able to reproduce this here. The difference isn't 6x on my machine, it's more like 3x, but it's still noticeable. I'll profile the read pattern and see if there's anything wacky going on. Holy canoli batman! The SDL_image PCX loader reads 1 byte at a time! So the question is, after we fix the PCX loader, do we need to implement buffering on top of the Win32 file I/O? There's actually an option to CreateFile() to explicitly disable buffering, and we don't use it...but on a closer reading of MSDN, I'm wondering if that means "don't save in the kernel's file cache for future reads by any process" vs "don't do a readahead buffer for this file in the current process." ...in the former case, yeah, one byte at a time is going to be slow. I guess this is a regression, I'm just concerned about adding the extra code to buffer it in 1.2 ... it would be better to fix the PCX loader and maybe add this for 1.3. People in 1.2 that _must_ have it can use the C runtime path instead of the Win32 API, or maybe just do less costly I/O calls than one-byte-at-a-time. --ryan. I just looked at the file format and various PCX loaders. Byte-at-a-time really is the only way to do it without accidentally reading past something at the end of the image data. I think we can probably get a pretty good win with a simple 1K read-ahead buffer that we mark dirty after a seek or write. I added a read-ahead buffer to the Win32 file I/O, and that took care of the problem. This is fixed in revision 3183. Thanks! |