I have a huffman encoded byte array of size 400 MB. Where the huffman tokens are all possible 4 bit values (0-15). I have to decode it within 1 minute. I need an efficient way to decode. In a 16gb ram windows system with a processor speed 2.8 Ghz. can i make it in 1 minute?
Asked
Active
Viewed 294 times
0
-
What you are saying doesn't make sense. You should have 256 different huffman tokens, not 16. Do you think "the tokens have all possible lengths" (1 to 15 bits)? Tokens can be longer than that. Decoding 7 MB per second or 400 cycles per byte would point to quite badly performing code. – gnasher729 Jun 03 '16 at 10:52
-
I meant the leaf values will be 0-15 (4 bit values). – Sayantan Ghosh Jun 03 '16 at 12:19
-
Fx8150 cpu single thread decoding (on 4-bit max encoded) makes 45MB/s when written in C++ language. – huseyin tugrul buyukisik Mar 01 '22 at 19:46
1 Answers
1
It took about eight seconds on my four-year old 2 GHz i7 processor, using zlib's inflate decompressor given only Huffman encoded input that was compressed 4:1 down to 400 MB.
So yes, you should be able to do much better than a minute.

Mark Adler
- 101,978
- 13
- 118
- 158
-
Since you apparently don't know how to spell "you", then Huffman decoding may be too difficult for you. What the heck is a "ds"? In any case, you can look at the inflate code in [zlib](http://zlib.net/) for how to do fast table-based Huffman decoding. – Mark Adler Jun 03 '16 at 16:57
-