File: test.pl

package info (click to toggle)
ocaml-benchmark 1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ml: 1,114; makefile: 45; perl: 12
file content (17 lines) | stat: -rwxr-xr-x 335 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use lib qw(.);
use Benchmark qw(timethese cmpthese);

sub f {
    my $g=0;
    foreach (0..$_[0]) { $g = 2.0 * 2.0 * 2.0 * 2.0 };
    $g;
};

$res = timethese(10, { foo => sub {f(1000000)},
                       bar => sub {f(2000000)},
                       baz => sub {f(3000000)}, });
print "\n";
cmpthese $res;