mirror of
https://github.com/ProgrammingRust/mandelbrot
synced 2024-11-15 06:12:52 +00:00
Remove code to measure effect of varying numbers of threads.
This commit is contained in:
parent
be390df13d
commit
791d5c403b
16
src/main.rs
16
src/main.rs
@ -172,17 +172,13 @@ fn main() {
|
||||
|
||||
let mut pixels = vec![0; bounds.0 * bounds.1];
|
||||
|
||||
for threads in [1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16,
|
||||
20, 30, 40, 50, 60, 70, 80, 90,
|
||||
//100, 200, 300, 400, 500, 600, 700, 800, 900, 1000
|
||||
].iter() {
|
||||
let band_rows = bounds.1 / 400;
|
||||
let threads = 8;
|
||||
let band_rows = bounds.1 / threads + 1;
|
||||
|
||||
let dt = measure_elapsed_time(|| {
|
||||
{
|
||||
let bands = Mutex::new(pixels.chunks_mut(band_rows * bounds.0).enumerate());
|
||||
crossbeam::scope(|scope| {
|
||||
for i in 0..*threads {
|
||||
for i in 0..threads {
|
||||
scope.spawn(|| {
|
||||
let mut count = 0;
|
||||
loop {
|
||||
@ -208,10 +204,6 @@ fn main() {
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
println!("{:4} {:.3}",
|
||||
threads,
|
||||
dt.as_secs() as f64 + dt.subsec_nanos() as f64 * 1e-9);
|
||||
}
|
||||
|
||||
write_image(&args[1], &pixels[..], bounds).expect("error writing PNG file");
|
||||
|
Loading…
Reference in New Issue
Block a user