View Single Post
Old 17 November 2014, 20:33   #34
Keir
Registered User
 
Join Date: May 2011
Location: Cambridge
Posts: 682
Quote:
Originally Posted by PeterK View Post
Thank you, kaffer

Your new inflate function is already much faster. It needs only 60 % longer now, but it is still more than 2 kB shorter than mine and also saves a lot of memory, which both can be very important for standard low-end Amigas like the A500 or A600. The PNG and OS4 icons can be converted into the OS 3.5 format. The difference for the complete icon reading, uncompressing, color processing and rendering is only 7 %.
One algorithmic difference I can see is that your bigtable has a full 9-bit lookup array for the literal/length symbol (9 bits is the longest code length in the static huffman encoding). Whereas I do an 8-bit prefix lookup, and codes longer than that fall through to a subtree for the remaining bits. That could make a bit of difference. I'm not sure all that much though, 8-bit + 1-bit lookup comes out quite nice in the code.

Apart from that it might just be some optimisations with an eye to 68020+. I add bytes to the input-buffering register lazily, as shifting bytes up into the most-significant position is expensive on 68000, whereas prefetching up front for the next few code lookups probably makes sense on 68020, avoiding some tests+branches, and the longer shifts up to the far end of the shift register have no extra cost on 68020+.

I'll have another browse of your code and see if there are any tricks to steal

If you could send me a Deflate stream for one or two icons that might be handy, then I can examine their profile a bit and see where time might be being spent.
Keir is offline  
 
Page generated in 0.04305 seconds with 11 queries