#Deflate re-implementation Issue.

1 messages · Page 1 of 1 (latest)

rugged fox
#

I saw 18062 and started hacking away at a simple deflate compressor according to rfc 1951.
I am confused as how to implement the compressor without passing an allocator as requested in the the issue.

I implemented the data structures required for the LZ77 component (hash_chain, sliding_window and the lookahead_buffer).
They increase the size of the executable 4-5x ,from 2mb to 8-10mb, depending on the optimize mode . which makes sense, as there are multiple buffers.

Have I misunderstood the issue? should the allocators be used after all the keep the executable small? maybe allocators should be passed to the compressor's methods (like UnManaged versions of the stdlib datastructures)?

Thanks in advanced!

GitHub

Global variables (unacceptable; warrants the "bug" label): zig/lib/std/compress/deflate/decompressor.zig Line 255 in ea4a077 var fixed_huffman_decoder: ?HuffmanDecoder = null; zig/lib/std...

balmy scaffold
#

how much space does the current deflate implementation allocate?

rugged fox
#

around 2.5mb with ReleaseSafe

balmy scaffold
#

what are you doing with your implementation that is causing 6-8mb of space to be used? and additionally, are you storing these statically (in say, a global var), or on the stack

rugged fox
#

I'm storing them on the stack, currently I'm creating a bunch of buffers for the lookahead and lookback, and the hash_chain.

#

The hash_chain is the culprit it is around 8mb (4096 buckets with [256]usize per bucket)

balmy scaffold
#

it might be worth finding a way to reduce that size

#

or: if you feel its necessary, use an allocator for now and figure out how to remove it later when you have a working implementation