Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Benchmarking your programs

Name: Anonymous 2009-09-05 15:22

How do you do it?
I was thinking of just using time, but I'd have to do everything manually, unless there's some way to get the results of time from a bash script.

Name: Anonymous 2009-09-06 21:11

I wrote a PHP benchmarking script that will echo the output infinitely. Have fun with it.


function get() {
    $timer = explode( ' ', microtime() );
    $timer = $timer[1] + $timer[0];
    return $timer;
}

$start = get();
do {
    $x = 7;
    $y = 1000;
    if ($x < $y) {
        echo $x + $y;
    }
} while ( $x = 7 );
$end = get();
echo round($end - $start, 4);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List