ハテナオヤさんのはてブでみたUnicode::Japaneseなんだけど、とりあえずベンチマークをとってみたら



daisuke@beefcake daisuke$ perl benchmark/h2z.pl
Rate unicode_japanese jcode
unicode_japanese 1236/s -- -32%
jcode 1825/s 48% --
daisuke@beefcake daisuke$

おりょ、Jcodeのほうがかなり速いね。こんな感じのコード。ふーむ。





my $obj = Jcode->new($str_h);
my $z = $obj->h2z->euc;

$obj = Jcode->new($str_z);
my $h = $obj->z2h->euc;
}

sub unicode_japanese
{
my $obj = Unicode::Japanese->new($str_h);
my $z = $obj->h2z->get;

$obj = Unicode::Japanese->new($str_z);
my $h = $obj->z2h->get;
}

cmpthese(10_000, {
jcode => \&jcode,
unicode_japanese => \&unicode_japanese
});