| 1 | use strict; | ||
| 2 | use Benchmark qw(cmpthese); | ||
| 3 | use File::MMagic; | ||
| 4 | use File::MMagic::XS; | ||
| 5 | |||
| 6 | my $fm = File::MMagic->new(); | ||
| 7 | my $fmxs = File::MMagic::XS->new(); | ||
| 8 | |||
| 9 | my $file = shift @ARGV; | ||
| 10 | cmpthese(10_000, { | ||
| 11 | xs => sub { $fmxs->get_mime($file) }, | ||
| 12 | perl => sub { $fm->checktype_filename($file) } | ||
| 13 | }); |