devkitPro / tex3ds

3DS Texture Conversion
GNU General Public License v3.0
38 stars 10 forks source link

lzss.cpp: use memcmp to optimize match-checking #37

Closed ds-sloth closed 1 month ago

ds-sloth commented 2 months ago

I recently started work on a stripped-down library fork of this tool for use in a conversion toolkit. While doing some profiling I found that the hottest code was in the LZ11 compression procedure. On my x86 machine at least, switching to memcmp rather than a manual loop for the comparison up to best_len sped up conversion overall by a factor of 4. Maybe this change will be useful to you upstream as well.