Brotli compression with all cores
I want to compress a stream but using all cpu cores for fastest compression
3 Replies
my current code
This is a harder problem than it probably first appears...
In order to have multithread compression, you'd have to break the file into chunks (Look into the Partitioner class for that), and then use a Parallel.ForEach to compress each chunk. And while that would work... you'd have to decompress each chunk and re-combine the exact same way. The order of chunk has to be persisted as metadata in order to decompress later.
but then i cant use the dictionary of first chunks onto the next ones
so i would end with larger file