about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-04 12:06:50 -0700
committerbors <bors@rust-lang.org>2014-05-04 12:06:50 -0700
commit59569397fbcd0a9b7b3649cd9957cace2d6889d8 (patch)
treec3a44d77822bc2528174ac4b4a18c599a46eb6c3
parentd8e5d2712cf13105e981ae25057f75daa889915d (diff)
parent2acab613774617739c328fa73a2123463080b254 (diff)
downloadrust-59569397fbcd0a9b7b3649cd9957cace2d6889d8.tar.gz
rust-59569397fbcd0a9b7b3649cd9957cace2d6889d8.zip
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.
-rw-r--r--src/test/bench/shootout-spectralnorm.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs
index f0cdc020dc3..e63c78d50af 100644
--- a/src/test/bench/shootout-spectralnorm.rs
+++ b/src/test/bench/shootout-spectralnorm.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(phase)]
+#[phase(syntax)] extern crate green;
 extern crate sync;
 
 use std::from_str::FromStr;
@@ -16,6 +18,8 @@ use std::cmp::min;
 use std::os;
 use sync::{Arc, RWLock};
 
+green_start!(main)
+
 fn A(i: uint, j: uint) -> f64 {
     ((i + j) * (i + j + 1) / 2 + i + 1) as f64
 }
@@ -38,7 +42,7 @@ fn mult(v: Arc<RWLock<Vec<f64>>>, out: Arc<RWLock<Vec<f64>>>,
     let (tx, rx) = channel();
 
     let len = out.read().len();
-    let chunk = len / 100 + 1;
+    let chunk = len / 20 + 1;
     for chk in count(0, chunk) {
         if chk >= len {break;}
         let tx = tx.clone();