performance measurements

Each table row shows performance measurements for this Rust program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,0002.332.3439,480342  1% 1% 0% 100%
5,000,00023.2723.2939,480342  1% 1% 0% 100%
50,000,000227.73227.8439,480342  1% 1% 0% 100%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read thread-ring benchmark to see what this program should do.

 notes

rustc 0.12.0 (ba4081a5a 2014-10-07 13:44:41 -0700)

 thread-ring Rust program source code

// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// contributed by TeXitoi

fn start(n_tasks: int, token: int) {
    let (tx, mut rx) = channel();
    tx.send(token);
    for i in range(2, n_tasks + 1) {
        let (tx, next_rx) = channel();
        spawn(proc() roundtrip(i, tx, rx));
        rx = next_rx;
    }
    spawn(proc() roundtrip(1, tx, rx));
}

fn roundtrip(id: int, tx: Sender<int>, rx: Receiver<int>) {
    for token in rx.iter() {
        if token == 1 {
            println!("{}", id);
            break;
        }
        tx.send(token - 1);
    }
}

fn main() {
    let args = std::os::args();
    let args = args.as_slice();
    let token = args.get(1)
        .and_then(|arg| from_str(arg.as_slice()))
        .unwrap_or(1000);
    let n_tasks = args.get(2)
        .and_then(|arg| from_str(arg.as_slice()))
        .unwrap_or(503);

    start(n_tasks, token);
}

 make, command-line, and program output logs

Mon, 13 Oct 2014 01:03:10 GMT

MAKE:
/usr/local/src/rust/bin/rustc --opt-level=3 -C target-cpu=core2 -C lto threadring.rs -o threadring.rust_run
rm threadring.rs
15.83s to complete and log all make actions

COMMAND LINE:
./threadring.rust_run 50000000

PROGRAM OUTPUT:
292

Revised BSD license

  Home   Conclusions   License   Play