#11 Flexibilize parallel compress a bit
I was trying to expose the functions to Python with PyO3 and there were/are some limitations around parallel compression. I’ve made some changes by replacing threadpool with rayon’s scoped thread pool to remove the need for 'static bound. In order to compress a vec (instead of an array) I need to implement Dst for Vec<u8>, but then in compress_frame:
let mut dst = D::new();
gives an empty vec, which crashes. With an array, this is known at compile time, so it works just fine.
I think passing a flag to parallel_compress and compress_frame indicating to create something with capacity would not be the right move, eg
fn compress_frame<D: Dst>(src: &[u8], level: usize, capacity: Option<usize>) -> Result<CompressedFrame<D>, Error> {
if Some(cap) = capacity {
let mut dst = D::with_capacity(cap);
} else {
let mut dst = D::new();
}
...
}
@pmeunier would you have an advice here?
(I’m having trouble to push the changes to the Nest)
Edit: Now the changes are all set.
3HPQTZ5KRH5RE5VF4OXVPDEEJUI3KYWX5MXI5E7KNGGTGL52MMDACSWKKLREPG5MBV3AWEYHM5RYNNMLV355FHJMU2WFJ3UL5LDSDMTQQCMWBPX2WV5JE5ABT3OZFA225IXEU2KVQWSADEXLSL46NLK7SGPFSACSWKKLREPG5MBV3AWEYHM5RYNNMLV355FHJMU2WFJ3UL5LDSDMTQQCFirst, I’m not sure why my pushes keep adding these (no change message) empty changes.
This last change I uploaded is the simpler fix I could think of, as a PoC. There must be a much better (Rust) way of doing it.