Compare commits
6 Commits
afe317404f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 853eead617 | |||
| bcf0430bf6 | |||
| a9231c64bc | |||
| df4bc1922f | |||
| 709ffb313f | |||
| 2ea8ba5a39 |
@@ -9,7 +9,7 @@ path = "src/main.rs"
|
|||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
strip = true # Automatically strip symbols from the binary.
|
strip = true # Automatically strip symbols from the binary.
|
||||||
opt-level = 3
|
opt-level = 2
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|||||||
24
src/main.rs
24
src/main.rs
@@ -15,7 +15,8 @@ mod function;
|
|||||||
mod plot;
|
mod plot;
|
||||||
|
|
||||||
const THREAD_CNT: usize = 20;
|
const THREAD_CNT: usize = 20;
|
||||||
const SAMPLE_LIMIT: usize = 100_000_000;
|
const SAMPLE_START: usize = 100_000_000_000;
|
||||||
|
const SAMPLE_LIMIT: usize = 1_000_000_000_000;
|
||||||
const SUB_SAMPLES: [usize; 3] = [1, 2, 5];
|
const SUB_SAMPLES: [usize; 3] = [1, 2, 5];
|
||||||
const SAMPLES_PER_ITERATION: usize = 250;
|
const SAMPLES_PER_ITERATION: usize = 250;
|
||||||
|
|
||||||
@@ -27,10 +28,10 @@ fn main() {
|
|||||||
let bounds: Bounds = Bounds::new(LinearBounds::new(3.1_f64, 3.2_f64), LinearBounds::new(-10_f64, 35_f64));
|
let bounds: Bounds = Bounds::new(LinearBounds::new(3.1_f64, 3.2_f64), LinearBounds::new(-10_f64, 35_f64));
|
||||||
let func: Function = Function::new(f);
|
let func: Function = Function::new(f);
|
||||||
|
|
||||||
let start: Instant = Instant::now();
|
//let start: Instant = Instant::now();
|
||||||
println!("{}\n{}ms", func.approximate(&bounds, 1_000_000_000, THREAD_CNT), start.elapsed().as_millis())
|
//println!("{}\n{}ms", func.approximate(&bounds, 10_000_000, THREAD_CNT), start.elapsed().as_millis())
|
||||||
|
|
||||||
//simulate(&bounds, &func)
|
simulate(&bounds, &func)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn simulate(bounds: &Bounds, func: &Function) {
|
fn simulate(bounds: &Bounds, func: &Function) {
|
||||||
@@ -48,13 +49,14 @@ fn simulate(bounds: &Bounds, func: &Function) {
|
|||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
sample_cnt *= 10;
|
sample_cnt *= 10;
|
||||||
}
|
|
||||||
result.print();
|
|
||||||
|
|
||||||
let file: io::Result<File> = File::create("output.json");
|
let file: io::Result<File> = File::create(format!("out/output{}.json", sample_cnt.ilog10()));
|
||||||
if file.is_err() {
|
if file.is_err() {
|
||||||
panic!("Error creating output file")
|
panic!("Error creating output file")
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(_) = file.unwrap().write(result.to_json().to_string().as_bytes()) { panic!("Error writing to file") };
|
if let Err(_) = file.unwrap().write(result.to_json().to_string().as_bytes()) { panic!("Error writing to file") };
|
||||||
|
|
||||||
|
result = Plot::new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user