Mercurial > op > Looping
annotate Looping.pl @ 12:dab1e83799e4 >>178 tip
R版のソースコードを追加。
author | "uncorrelated zombie" <uncorrelated@yahoo.co.jp> |
---|---|
date | Sat, 04 Feb 2012 04:10:01 +0900 |
parents | 5e09f7cf87f5 |
children |
rev | line source |
---|---|
6
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
1 #!/usr/bin/perl -w |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
2 use Time::HiRes qw(gettimeofday); |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
3 use Looping; |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
4 |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
5 sub gettimeofday_sec { |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
6 my ($sec, $microsec) = gettimeofday; |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
7 return $sec + $microsec*1e-6; |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
8 } |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
9 |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
10 my $o = Looping->new; |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
11 my $n = 1; |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
12 |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
13 my $t1 = gettimeofday_sec(); |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
14 for(my $c=0;$c<2147483647;$c++){ |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
15 $n = $o->calc($n); |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
16 } |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
17 my $t2 = gettimeofday_sec(); |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
18 |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
19 printf("%d\nPerl\t%f", $n, $t2 - $t1); |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
20 |
5e09f7cf87f5
Perl版のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff
changeset
|
21 |