Skip to content

Commit

Permalink
Revert copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya ujeniya committed Sep 13, 2024
1 parent 54e677e commit 9e4be75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ path = "src/main.rs"
[profile.release]
debug = false
lto = true
incremental = false
incremental = false
Binary file modified bench
Binary file not shown.
8 changes: 5 additions & 3 deletions src/kernels/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ pub fn copy(c: &mut [f64], a: &[f64], n: usize) -> f64 {
// }

// Parallel version
c_iter.zip(a_iter).for_each(|(c_slice, a_slice)| {
c_slice.copy_from_slice(a_slice);
});
c.par_chunks_mut(n)
.zip(a.par_chunks(n))
.for_each(|(c_slice, a_slice)| {
c_slice.copy_from_slice(a_slice);
});

s.elapsed().as_secs_f64()
}

0 comments on commit 9e4be75

Please sign in to comment.