performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
5001.981.992,020333  99% 0% 1% 1%
3,00068.8868.923,152333  1% 86% 14% 0%
5,500229.81229.893,860333  96% 0% 0% 4%

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

Read spectral-norm benchmark to see what this program should do.

 notes

This is perl 5, version 18, subversion 0 (v5.18.0) built for i686-linux-thread-multi

Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_ITHREADS
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API

 spectral-norm Perl program source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# Contributed by Andrew Rodland
# modified by R. Jelinek

use strict;

my $n = @ARGV ? shift : 500;
my @v = multiplyAtAv(
    multiplyAtAv(
        multiplyAtAv(
            (1) x $n
        )
    )
    );

my @u = multiplyAtAv( @v );

my ($vBv, $vv);
my $i = 0;
for my $v (@v) {
    $vBv += $u[$i++] * $v;
    $vv += $v ** 2;
}

printf( "%0.9f\n", sqrt( $vBv / $vv ) );

sub multiplyAtAv {
    return multiplyAtv( multiplyAv( @_ ) );
}

sub eval_A {
    use integer;
    my $sum = $_[0] + $_[1];
    my $div = ($sum**2 + $sum) / 2 + $_[0] + 1;
    no integer;
    1 / $div;
}

sub multiplyAv {
    return map {
        my ($i, $sum) = ($_);
        $sum += eval_A($i, $_) * $_[$_] for 0 .. $#_;
        $sum;
    } 0 .. $#_;
}

sub multiplyAtv {
    return map {
        my ($i, $sum) = ($_);
        $sum += eval_A($_, $i) * $_[$_] for 0 .. $#_;
        $sum;
    } 0 .. $#_;
}

 make, command-line, and program output logs

Wed, 22 May 2013 11:10:03 GMT

COMMAND LINE:
/usr/local/src/perl-5.18.0/bin/perl spectralnorm.perl 5500

PROGRAM OUTPUT:
1.274224153

Revised BSD license

  Home   Conclusions   License   Play