変換にかかる時間(その2)

                             <p>ソースコード</p>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl

use Benchmark;
use Jcode;

$count = 50000;

    $icode = 'sjis';
#    $icode = 'euc';
#    $icode = 'jis';
#    $icode = 'utf8';

$japanese = 'あいうえお阿衣兎得緒';
&amp;Jcode::convert($japanese, $icode);

print "Content-type: text/htmlnn";
print "<html><head><title></title></head>n";
print "<body>n";
print "<pre>n";

@t = timethese($count, {
     'to_SJIS' => '&amp;to_sjis;'
    ,'to_EUC'  => '&amp;to_euc;'
    ,'to_JIS'  => '&amp;to_jis;'
#    ,'to_UTF8' => '&amp;to_utf8;'
});

print "</pre>n";
print "</body></html>n";

exit(0);

sub to_sjis{
    &amp;Jcode::convert($japanese, 'sjis', $icode);
}

sub to_euc{
    &amp;Jcode::convert($japanese, 'euc',  $icode);
}

sub to_jis{
    &amp;Jcode::convert($japanese, 'jis',  $icode);
}

sub to_utf8{
    &amp;Jcode::convert($japanese, 'utf8', $icode);
}
                          </div>

Comments

comments powered by Disqus