From 2acab613774617739c328fa73a2123463080b254 Mon Sep 17 00:00:00 2001 From: Guillaume Pinot Date: Sat, 3 May 2014 23:11:23 +0200 Subject: [PATCH] shootout-spectralnorm tweaks - 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. --- src/test/bench/shootout-spectralnorm.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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>>, out: Arc>>, 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();