diff --git a/Cargo.toml b/Cargo.toml index bb5afc7..ead6ed1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bdflib" -version = "0.4.1" +version = "0.4.2" authors = ["trivernis "] edition = "2018" license-file = "LICENSE" diff --git a/src/io.rs b/src/io.rs index eb428f9..38222bb 100644 --- a/src/io.rs +++ b/src/io.rs @@ -247,7 +247,7 @@ impl BDFReader { /// Starts threads for decompressing chunks fn start_threads(&mut self) { - for _ in 0..num_cpus::get() { + for _ in 0..num_cpus::get()/2 { thread::spawn({ let r = self.thread_manager.receiver_work.clone(); let s = self.thread_manager.sender_result.clone(); @@ -260,6 +260,10 @@ impl BDFReader { drop(wg); } }); + } + // add some initial data to be decompressed. + // the data that is added is four times the number of threads + for _ in 0..num_cpus::get() * 2 { if let Err(_) = self.add_compression_chunk() { self.thread_manager.drop_sender(); break;