Skip to content

Commit

Permalink
Revert "chore: Try out rayon for data parallelism"
Browse files Browse the repository at this point in the history
This reverts commit 8d9e269.

No longer needed, but wanted to keep the code around for reference.

Execute with `cargo bench rayon`.
  • Loading branch information
alexpovel committed Aug 31, 2023
1 parent 8d9e269 commit bc91eb8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 109 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ unicode_titlecase = "2.2.1"
fst = "0.4.7"
once_cell = "1.18.0"
decompound = "0.3.0"
rayon = "1.7.0"

[features]
default = ["all"]
Expand Down Expand Up @@ -61,7 +60,3 @@ rayon = "1.7.0"
[[bench]]
name = "threading"
harness = false

[[bench]]
name = "rayon"
harness = false
78 changes: 0 additions & 78 deletions benches/rayon.rs

This file was deleted.

26 changes: 0 additions & 26 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

pub use crate::stages::Stage;
use log::{debug, info};
use rayon::prelude::*;
use std::io::{BufRead, Error, Write};

/// Internal macros. Have to live here to be usable in unit, not just integration
Expand Down Expand Up @@ -93,28 +92,3 @@ pub fn apply(
info!("Exiting");
Ok(())
}

/// Docs
/// # Errors
/// None. Life is perfect.
pub fn apply_par(
stages: &Vec<Box<dyn Stage>>,
source: &mut impl BufRead,
destination: &mut impl Write,
) -> Result<(), Error> {
let mut lines = source.lines().collect::<Result<Vec<_>, _>>()?;

lines.par_iter_mut().try_for_each(|line| {
for stage in stages {
let result = stage.substitute(line)?;
*line = result.0;
}
Ok::<(), Error>(())
})?;

for line in lines {
destination.write_all(line.as_bytes())?;
}

Ok(())
}
Binary file removed violin.png
Binary file not shown.

0 comments on commit bc91eb8

Please sign in to comment.