Fix optimization

master
Trivernis 5 years ago
parent 580b956b54
commit 1c1a8b9454

@ -6,6 +6,9 @@ edition = "2018"
# 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
[profile.release]
opt-level = 1
[dependencies] [dependencies]
rayon = "1.3.0" rayon = "1.3.0"
crossbeam-channel = "0.4.2" crossbeam-channel = "0.4.2"

@ -7,11 +7,12 @@ use benchlib::benching::Bencher;
pub fn main() { pub fn main() {
let mut bencher = Bencher::new(); let mut bencher = Bencher::new();
bencher bencher
.set_iterations(100000000) .set_iterations(1000000)
.print_settings() .print_settings()
.bench("Dry Run", || {})
.bench("Multiply to 100", || to_bench::multiply_to(100)) .bench("Multiply to 100", || to_bench::multiply_to(100))
.bench("Summation from 0u128 to 1000000", || { .bench("Summation from 0u128 to 1000", || {
to_bench::summation_to_1000000() to_bench::summation_to_1000()
}) })
.set_iterations(1000) .set_iterations(1000)
.print_settings() .print_settings()

@ -10,9 +10,9 @@ pub fn start_stop_thread() {
handle.join().unwrap(); handle.join().unwrap();
} }
pub fn summation_to_1000000() -> u128 { pub fn summation_to_1000() -> u128 {
let mut res = 0u128; let mut res = 0u128;
for i in 0u128..1000000 { for i in 0u128..1000 {
res += i; res += i;
} }
res res

Loading…
Cancel
Save