File: benchmark.pl

package info (click to toggle)
libfile-mmagic-xs-perl 0.09003-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 340 kB
  • ctags: 596
  • sloc: perl: 950; ansic: 536; makefile: 51; xml: 1
file content (13 lines) | stat: -rw-r--r-- 291 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
use strict;
use Benchmark qw(cmpthese);
use File::MMagic;
use File::MMagic::XS;

my $fm   = File::MMagic->new();
my $fmxs = File::MMagic::XS->new();

my $file = shift @ARGV;
cmpthese(10_000, {
    xs   => sub { $fmxs->get_mime($file) },
    perl => sub { $fm->checktype_filename($file) }
});