File: b.pl

package info (click to toggle)
libfile-libmagic-perl 0.96-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 232 kB
  • sloc: perl: 290; pascal: 88; ansic: 54; makefile: 13
file content (19 lines) | stat: -rw-r--r-- 381 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! perl -w

use lib qw(../blib/lib ../blib/arch ../blib/lib/auto ../blib/arch/auto);

use File::LibMagic ':all';
use Benchmark qw(timethese cmpthese);

my $handle=magic_open(0);
my $ret   =magic_load($handle,"");

my $r=timethese(5000, {
	a => sub { my $a=magic_buffer($handle,"Hi\n"); },
	b => sub { my $a=MagicBuffer("Hi\n"); },
      } );

cmpthese($r);

magic_close($handle);