diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Looping.pl	Fri Feb 18 19:58:26 2011 +0900
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+use Time::HiRes qw(gettimeofday);
+use Looping;
+
+sub gettimeofday_sec {
+  my ($sec, $microsec) = gettimeofday;
+  return $sec + $microsec*1e-6;
+}
+
+my $o = Looping->new;
+my $n = 1;
+
+my $t1 = gettimeofday_sec();
+for(my $c=0;$c<2147483647;$c++){
+  $n = $o->calc($n);
+}
+my $t2 = gettimeofday_sec();
+
+printf("%d\nPerl\t%f", $n, $t2 - $t1);
+
+