From 840070c5126e87d3e136260ab0c994bc4ec6848a Mon Sep 17 00:00:00 2001 From: Lenny222 Date: Sat, 31 Dec 2011 17:11:11 +0100 Subject: [PATCH] read the inputs from args, as the orignal code does --- src/test/bench/shootout-nbody.rs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 136d1057d2038..c70f02ef44e7d 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -7,25 +7,16 @@ native mod llvm { fn sqrt(n: float) -> float; } -fn main() { - // - // Leave these commented out to - // finish in a reasonable time - // during 'make check' under valgrind - // 5000000 - // 50000000 - let inputs: [int] = [50000, 500000]; +fn main(args: [str]) { + let n = int::from_str(args[1]); let bodies: [Body::props] = NBodySystem::MakeNBodySystem(); + log(debug, NBodySystem::energy(bodies)); - for n: int in inputs { - log(debug, NBodySystem::energy(bodies)); - - let i: int = 0; - while i < n { NBodySystem::advance(bodies, 0.01); i += 1; } - log(debug, NBodySystem::energy(bodies)); - } + let i: int = 0; + while i < n { NBodySystem::advance(bodies, 0.01); i += 1; } + log(debug, NBodySystem::energy(bodies)); } // Body::props is a record of floats, so