Skip to content

Commit 5956939

Browse files
committed
auto merge of #13921 : TeXitoi/rust/shootout-spectralnorm-tweaks, r=alexcrichton
- using libgreen to optimize CPU usage - less tasks to limit wasted resources Here, on a one core 2 threads CPU, new version is ~1.2 faster. May be better with more core.
2 parents d8e5d27 + 2acab61 commit 5956939

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/bench/shootout-spectralnorm.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(phase)]
12+
#[phase(syntax)] extern crate green;
1113
extern crate sync;
1214

1315
use std::from_str::FromStr;
@@ -16,6 +18,8 @@ use std::cmp::min;
1618
use std::os;
1719
use sync::{Arc, RWLock};
1820

21+
green_start!(main)
22+
1923
fn A(i: uint, j: uint) -> f64 {
2024
((i + j) * (i + j + 1) / 2 + i + 1) as f64
2125
}
@@ -38,7 +42,7 @@ fn mult(v: Arc<RWLock<Vec<f64>>>, out: Arc<RWLock<Vec<f64>>>,
3842
let (tx, rx) = channel();
3943

4044
let len = out.read().len();
41-
let chunk = len / 100 + 1;
45+
let chunk = len / 20 + 1;
4246
for chk in count(0, chunk) {
4347
if chk >= len {break;}
4448
let tx = tx.clone();

0 commit comments

Comments
 (0)