← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/pan_genome_post_analysis
  Run on Fri Mar 27 11:43:32 2015
Reported on Fri Mar 27 11:46:18 2015

Filename/Users/ap13/perl5/lib/perl5/Number/Compare.pm
StatementsExecuted 8 statements in 252µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112µs24µsNumber::Compare::::BEGIN@2Number::Compare::BEGIN@2
1117µs30µsNumber::Compare::::BEGIN@3Number::Compare::BEGIN@3
1117µs24µsNumber::Compare::::BEGIN@4Number::Compare::BEGIN@4
0000s0sNumber::Compare::::newNumber::Compare::new
0000s0sNumber::Compare::::parse_to_perlNumber::Compare::parse_to_perl
0000s0sNumber::Compare::::testNumber::Compare::test
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Number::Compare;
2224µs236µs
# spent 24µs (12+12) within Number::Compare::BEGIN@2 which was called: # once (12µs+12µs) by File::Find::Rule::BEGIN@7 at line 2
use strict;
# spent 24µs making 1 call to Number::Compare::BEGIN@2 # spent 12µs making 1 call to strict::import
3223µs252µs
# spent 30µs (7+22) within Number::Compare::BEGIN@3 which was called: # once (7µs+22µs) by File::Find::Rule::BEGIN@7 at line 3
use Carp qw(croak);
# spent 30µs making 1 call to Number::Compare::BEGIN@3 # spent 22µs making 1 call to Exporter::import
42202µs241µs
# spent 24µs (7+17) within Number::Compare::BEGIN@4 which was called: # once (7µs+17µs) by File::Find::Rule::BEGIN@7 at line 4
use vars qw/$VERSION/;
# spent 24µs making 1 call to Number::Compare::BEGIN@4 # spent 17µs making 1 call to vars::import
51600ns$VERSION = '0.03';
6
7sub new {
8 my $referent = shift;
9 my $class = ref $referent || $referent;
10 my $expr = $class->parse_to_perl( shift );
11
12 bless eval "sub { \$_[0] $expr }", $class;
13}
14
15sub parse_to_perl {
16 shift;
17 my $test = shift;
18
19 $test =~ m{^
20 ([<>]=?)? # comparison
21 (.*?) # value
22 ([kmg]i?)? # magnitude
23 $}ix
24 or croak "don't understand '$test' as a test";
25
26 my $comparison = $1 || '==';
27 my $target = $2;
28 my $magnitude = $3 || '';
29 $target *= 1000 if lc $magnitude eq 'k';
30 $target *= 1024 if lc $magnitude eq 'ki';
31 $target *= 1000000 if lc $magnitude eq 'm';
32 $target *= 1024*1024 if lc $magnitude eq 'mi';
33 $target *= 1000000000 if lc $magnitude eq 'g';
34 $target *= 1024*1024*1024 if lc $magnitude eq 'gi';
35
36 return "$comparison $target";
37}
38
39sub test { $_[0]->( $_[1] ) }
40
4113µs1;
42
43__END__