Mercurial > mercurial > hgweb_ai.cgi
comparison 02.pl @ 0:43e580fa4719
first commit.
author | pyon@macmini |
---|---|
date | Mon, 04 Sep 2017 21:40:33 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:43e580fa4719 |
---|---|
1 # Last Change: 2017-09-04 Mon 21:39:25. | |
2 # | |
3 | |
4 use v5.10; | |
5 use utf8; | |
6 use Inline C; | |
7 use Benchmark; | |
8 | |
9 # read params from json | |
10 | |
11 # read data | |
12 my ( @n, @date, @start, @highest, @lowest, $ma3, $ma7, $ma30 ); | |
13 open my $f, '<', 'data'; | |
14 while ( <$f> ) { | |
15 chomp; | |
16 my ( $nn, $dt, $st, $hi, $low, $en, $m3, $m7, $m30 ) = split; | |
17 push @n, $nn; | |
18 push @date, $dt; | |
19 push @start, $st; | |
20 push @end, $en; | |
21 push @ma3, $m3; | |
22 push @ma7, $m7; | |
23 push @ma30, $m30; | |
24 } | |
25 close $f; | |
26 | |
27 # L2 | |
28 hoge( scalar @n, @n ); | |
29 | |
30 #timethese( 10000000, { | |
31 #Perl => sub { for ( 1..10 ) { $x = $_ * $_; } }, | |
32 #C => sub { pow_test(); } | |
33 #} ); | |
34 | |
35 __DATA__ | |
36 __C__ | |
37 #include <stdio.h> | |
38 | |
39 int pow_test(){ | |
40 int j; | |
41 for ( int i = 0; i < 100000; i++ ) { | |
42 j = i * i; | |
43 } | |
44 return j; | |
45 } | |
46 | |
47 int hoge( int n, char* nn[] ) { | |
48 for ( int i=0; i<n; i++ ) { | |
49 pritnf( "%04d -> %s\n", i,nn ); | |
50 } | |
51 return 0; | |
52 } |