-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
26 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,29 @@ | ||
use stochastic_rs::{process::fbm::Fbm, Sampling}; | ||
use stochastic_rs::{noise::fgn::Fgn, Sampling}; | ||
|
||
fn main() { | ||
// let fbm = Fbm::new(&Fbm { | ||
// hurst: 0.9, | ||
// n: 10000, | ||
// t: None, | ||
// m: Some(100), | ||
// ..Default::default() | ||
// }); | ||
let fbm = Fgn::new(0.9, 10000, None, Some(10000)); | ||
|
||
// let mut runs = Vec::new(); | ||
|
||
// for _ in 0..20 { | ||
// let start = std::time::Instant::now(); | ||
// for _ in 0..1000 { | ||
// let _ = fbm.sample_par(); | ||
// } | ||
let start = std::time::Instant::now(); | ||
for _ in 0..10000 { | ||
let _ = fbm.sample(); | ||
} | ||
|
||
// let duration = start.elapsed(); | ||
// println!( | ||
// "Time elapsed in expensive_function() is: {:?}", | ||
// duration.as_secs_f32() | ||
// ); | ||
// runs.push(duration.as_secs_f32()); | ||
// } | ||
let duration = start.elapsed(); | ||
println!( | ||
"Time elapsed in expensive_function() is: {:?}", | ||
duration.as_secs_f32() | ||
); | ||
|
||
// let sum: f32 = runs.iter().sum(); | ||
// let average = sum / runs.len() as f32; | ||
// println!("Average time: {}", average); | ||
let fbm = Fbm::new(&Fbm { | ||
hurst: 0.9, | ||
n: 10000, | ||
t: None, | ||
m: Some(100), | ||
..Default::default() | ||
}); | ||
let fbm = Fgn::new(0.9, 10000, None, Some(10000)); | ||
|
||
for _ in 0..10 { | ||
let start = std::time::Instant::now(); | ||
for _ in 0..1000 { | ||
let _ = fbm.sample(); | ||
} | ||
let duration = start.elapsed(); | ||
println!( | ||
"Time elapsed in expensive_function() is: {:?}", | ||
duration.as_secs_f32() | ||
); | ||
let start = std::time::Instant::now(); | ||
for _ in 0..10000 { | ||
let _ = fbm.sample(); | ||
} | ||
|
||
let duration = start.elapsed(); | ||
println!( | ||
"Time elapsed in expensive_function() is: {:?}", | ||
duration.as_secs_f32() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters