Removing 'static from compress_frame

[?]
EA5TmpmTEqSKPj4q9VNMvmRVbN4j11YWX8FSxAAoTVCp
Feb 27, 2022, 12:22 PM
3HPQTZ5KRH5RE5VF4OXVPDEEJUI3KYWX5MXI5E7KNGGTGL52MMDAC

Dependencies

  • [2] EHPJVZ3M Fixing seekable errors, and version 0.2.2
  • [3] SWKKLREP
  • [4] GXWDF2M2 Debugging (including moving to xxhash-rust instead of twox-hash)
  • [5] TTRHEUTN Changing permissions
  • [6] HELRYMZK Manual bindings (Windows and Clang aren't very good friends), and getting rid of anyhow
  • [7] N625OONS Version bump
  • [8] IH334Q5A Reboot
  • [9] MHZGMWJE Reorganising the files
  • [10] FOFMWK53 Fixing a panic in copy_from_slice
  • [11] UPRY2FEL Remove bindgen dependency
  • [12] TKSHSYFM Using pkg-config to find the libraries (+ some cleanup)
  • [13] 53LCNWY2 Fixing compilation errors on Windows
  • [14] NOSZA4ZM Fixing tests
  • [*] 57ARVVZE Adding one more test

Change contents

  • file move: tests (d--r------)tests (d--r------)
    [3.1]
    [4.1672]
  • edit in tests/tests.rs at line 98
    [16.1747]
    [4.4185]
    #[cfg(feature = "threadpool")]
    fn test_par_4() {
    let mut output = Vec::new();
    let chunck_size: usize = 200;
    let vec_data = &DATA.to_vec();
    parallel_compress::<&mut Vec<u8>, Vec<u8>>(&vec_data, &mut output, 10, 4, chunck_size).unwrap();
    let mut decomp = Vec::new();
    let mut s = Seekable::init_buf(&mut output[..]).unwrap();
    for frame in 0..s.get_num_frames() {
    let size = s.get_frame_decompressed_size(frame).unwrap() as usize;
    let n = decomp.len();
    decomp.extend(std::iter::repeat(0).take(size));
    s.decompress_frame(&mut decomp[n..], frame).unwrap();
    }
    println!("{:?}", std::str::from_utf8(&decomp).unwrap());
    assert_eq!(&vec_data[..], &decomp[..])
    }
    #[test]
  • file addition: test (----------)
    [3.1]
  • file move: src (d--r------)src (d--r------)
    [3.1]
    [4.241235]
  • edit in src/compress/mod.rs at line 211
    [4.21576]
    [4.7633]
    impl Dst for Vec<u8> {
    fn as_mut_ptr(&mut self) -> *mut u8 {
    self.as_mut_ptr()
    }
    fn as_slice(&self) -> &[u8] {
    self.as_slice()
    }
    fn len(&self) -> usize {
    self.len()
    }
    fn new() -> Self {
    Self::new()
    }
    }
  • replacement in src/compress/mod.rs at line 270
    [4.22516][4.8720:8815]()
    pub fn parallel_compress<W: std::io::Write, D: Dst + 'static>(
    src: &'static [u8],
    [4.22516]
    [4.8815]
    pub fn parallel_compress<'a, W: std::io::Write, D: Dst>(
    src: &'a [u8],
  • edit in src/compress/mod.rs at line 277
    [4.8937]
    [4.8937]
    use rayon_core::ThreadPoolBuilder;
  • edit in src/compress/mod.rs at line 279
    [4.8975][4.8975:9011]()
    use threadpool::ThreadPool;
  • replacement in src/compress/mod.rs at line 281
    [4.9102][4.9102:9144]()
    let pool = ThreadPool::new(jobs);
    [4.9102]
    [4.22896]
    let pool = ThreadPoolBuilder::new().num_threads(jobs).build().unwrap();
  • replacement in src/compress/mod.rs at line 284
    [4.9179][4.9179:9505]()
    for (i, chunk) in src.chunks(chunk_size).enumerate() {
    let tx = tx.clone();
    pool.execute(move || {
    let frame = compress_frame(chunk, level);
    tx.send((i, frame))
    .expect("channel will be there waiting for the pool");
    });
    }
    [4.9179]
    [4.23221]
    pool.scope(move |s| {
    for (i, chunk) in src.chunks(chunk_size).enumerate() {
    let tx = tx.clone();
    s.spawn(move |_| {
    let frame = compress_frame(chunk, level);
    tx.send((i, frame))
    .expect("channel will be there waiting for the pool");
    });
    }
    });
  • file move: default.nix (----------)default.nix (----------)
    [3.1]
    [4.265892]
  • file move: build.rs (----------)build.rs (----------)
    [3.1]
    [4.266097]
  • file move: README.md (----------)README.md (----------)
    [3.1]
    [4.269454]
  • file move: Cargo.toml (----------)Cargo.toml (----------)
    [3.1]
    [4.269658]
  • replacement in Cargo.toml at line 4
    [4.269755][2.341:359]()
    version = "0.2.2"
    [4.269755]
    [4.18]
    version = "0.2.3"
  • edit in Cargo.toml at line 21
    [4.270377]
    [4.270377]
    [features]
    threadpool = ["rayon-core"]
  • replacement in Cargo.toml at line 27
    [4.270438][4.10232:10342]()
    threadpool = { version = "1.8", optional = true }
    xxhash-rust = { version = "0.8.2", features = [ "xxh64" ] }
    [4.270438]
    [4.270457]
    rayon-core = { version = "1.9", optional = true }
    xxhash-rust = { version = "0.8", features = [ "xxh64" ] }
  • file move: Cargo.lock (----------)Cargo.lock (----------)
    [3.1]
    [4.5467]
  • edit in Cargo.lock at line 6
    [4.5762]
    [4.10447]
    name = "autocfg"
    version = "1.1.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
    [[package]]
  • edit in Cargo.lock at line 18
    [4.10572]
    [4.6185]
    ]
    [[package]]
    name = "cfg-if"
    version = "1.0.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
    [[package]]
    name = "crossbeam-channel"
    version = "0.5.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
    dependencies = [
    "cfg-if",
    "crossbeam-utils",
    ]
    [[package]]
    name = "crossbeam-deque"
    version = "0.8.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
    dependencies = [
    "cfg-if",
    "crossbeam-epoch",
    "crossbeam-utils",
    ]
    [[package]]
    name = "crossbeam-epoch"
    version = "0.9.7"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9"
    dependencies = [
    "cfg-if",
    "crossbeam-utils",
    "lazy_static",
    "memoffset",
    "scopeguard",
  • edit in Cargo.lock at line 61
    [4.6200]
    [4.6200]
    name = "crossbeam-utils"
    version = "0.8.7"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
    dependencies = [
    "cfg-if",
    "lazy_static",
    ]
    [[package]]
  • edit in Cargo.lock at line 80
    [4.6423]
    [4.6423]
    name = "lazy_static"
    version = "1.4.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
    [[package]]
  • edit in Cargo.lock at line 90
    [4.6599]
    [4.6599]
    [[package]]
    name = "memoffset"
    version = "0.6.5"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
    dependencies = [
    "autocfg",
    ]
  • edit in Cargo.lock at line 135
    [4.8208]
    [4.10672]
    name = "rayon-core"
    version = "1.9.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
    dependencies = [
    "crossbeam-channel",
    "crossbeam-deque",
    "crossbeam-utils",
    "lazy_static",
    "num_cpus",
    ]
    [[package]]
    name = "scopeguard"
    version = "1.1.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
    [[package]]
  • edit in Cargo.lock at line 202
    [4.9592][4.9592:9803](),[4.10064][4.10064:10079]()
    name = "threadpool"
    version = "1.8.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
    dependencies = [
    "num_cpus",
    ]
    [[package]]
  • replacement in Cargo.lock at line 215
    [4.10508][2.360:378]()
    version = "0.2.2"
    [4.10508]
    [4.10526]
    version = "0.2.3"
  • edit in Cargo.lock at line 220
    [4.10567]
    [4.11373]
    "rayon-core",
  • edit in Cargo.lock at line 224
    [4.10581][4.10581:10596]()
    "threadpool",
  • file addition: test (----------)
    [3.1]