#177 iReadLump() is innefficient

open
nobody
None
5
2009-06-09
2009-06-09
G. Myers
No

This isn't a bug in a functional sense, but it could be considered a bug from a performance point of view. il_files.c::iReadLump() implements a loop to copy a single byte at a time from a lump to a working buffer and executes a conditional test after each read. This makes the code needlessly slow, and should be rewritten to execute the same logic in a more efficient fashion. From the SVN logs, it appears that darkyojimbo implemented such a change in r931, but then reverted it in r935 in lieu of further testing.

The attached patch realizes a ~4.5x speed improvement on my machine for reading a lump of ~4MB. Obviously this will vary from machine to machine.

NOTE: All of the paths in the patch code have not been adequately tested so I recommend careful code review by the community before the patch is added to the baseline.

Discussion

  • G. Myers
    G. Myers
    2009-06-09

    Patch to improve iReadLump() speed

     
    Attachments