comparison Looping.pl @ 8:30da8c1da4d4 >>178

SmalltalkやScalar版のベンチマークを追加。
author "uncorrelated zombie" <uncorrelated@yahoo.co.jp>
date Fri, 18 Feb 2011 19:58:26 +0900
parents 5e09f7cf87f5
children
comparison
equal deleted inserted replaced
4:d788c88f41bd 8:30da8c1da4d4
1 #!/usr/bin/perl -w
2 use Time::HiRes qw(gettimeofday);
3 use Looping;
4
5 sub gettimeofday_sec {
6 my ($sec, $microsec) = gettimeofday;
7 return $sec + $microsec*1e-6;
8 }
9
10 my $o = Looping->new;
11 my $n = 1;
12
13 my $t1 = gettimeofday_sec();
14 for(my $c=0;$c<2147483647;$c++){
15 $n = $o->calc($n);
16 }
17 my $t2 = gettimeofday_sec();
18
19 printf("%d\nPerl\t%f", $n, $t2 - $t1);
20
21