Skip to content

Commit

Permalink
use loole instead of flume
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdi-shojaee committed Dec 5, 2023
1 parent 3a09cdd commit 59f0ee7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bit_field = "^0.10.1" # exr file version bit flags
miniz_oxide = "^0.7.1" # zip compression for pxr24
smallvec = "^1.7.0" # make cache-friendly allocations TODO profile if smallvec is really an improvement!
rayon-core = "^1.11.0" # threading for parallel compression TODO make this an optional feature?
flume = { version = "^0.11.0", default-features = false } # crossbeam, but less unsafe code TODO make this an optional feature?
loole = "0.1.13"
zune-inflate = { version = "^0.2.3", default-features = false, features = ["zlib"] } # zip decompression, faster than miniz_oxide

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions src/block/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ impl<R: ChunksReader> SequentialBlockDecompressor<R> {
#[derive(Debug)]
pub struct ParallelBlockDecompressor<R: ChunksReader> {
remaining_chunks: R,
sender: flume::Sender<Result<UncompressedBlock>>,
receiver: flume::Receiver<Result<UncompressedBlock>>,
sender: loole::Sender<Result<UncompressedBlock>>,
receiver: loole::Receiver<Result<UncompressedBlock>>,
currently_decompressing_count: usize,
max_threads: usize,

Expand Down Expand Up @@ -437,7 +437,7 @@ impl<R: ChunksReader> ParallelBlockDecompressor<R> {

let max_threads = pool.current_num_threads().max(1).min(chunks.len()) + 2; // ca one block for each thread at all times

let (send, recv) = flume::unbounded(); // TODO bounded channel simplifies logic?
let (send, recv) = loole::unbounded(); // TODO bounded channel simplifies logic?

Ok(Self {
shared_meta_data_ref: Arc::new(chunks.meta_data().clone()),
Expand Down
6 changes: 3 additions & 3 deletions src/block/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ pub struct ParallelBlocksCompressor<'w, W> {
meta: &'w MetaData,
sorted_writer: SortedBlocksWriter<'w, W>,

sender: flume::Sender<Result<(usize, usize, Chunk)>>,
receiver: flume::Receiver<Result<(usize, usize, Chunk)>>,
sender: loole::Sender<Result<(usize, usize, Chunk)>>,
receiver: loole::Receiver<Result<(usize, usize, Chunk)>>,
pool: rayon_core::ThreadPool,

currently_compressing_count: usize,
Expand Down Expand Up @@ -379,7 +379,7 @@ impl<'w, W> ParallelBlocksCompressor<'w, W> where W: 'w + ChunksWriter {
};

let max_threads = pool.current_num_threads().max(1).min(chunks_writer.total_chunks_count()) + 2; // ca one block for each thread at all times
let (send, recv) = flume::unbounded(); // TODO bounded channel simplifies logic?
let (send, recv) = loole::unbounded(); // TODO bounded channel simplifies logic?

Some(Self {
sorted_writer: SortedBlocksWriter::new(meta, chunks_writer),
Expand Down

0 comments on commit 59f0ee7

Please sign in to comment.