← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:10 2015

Filename/var/www/foswiki11/lib/Foswiki/Query/BinaryOP.pm
StatementsExecuted 140730 statements in 206ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
876722181ms1.56sFoswiki::Query::BinaryOP::::evalTestFoswiki::Query::BinaryOP::evalTest
87671193.9ms145msFoswiki::Query::BinaryOP::::compareFoswiki::Query::BinaryOP::compare
87671136.9ms36.9msFoswiki::Query::BinaryOP::::_isNumberFoswiki::Query::BinaryOP::_isNumber
12011634µs938µsFoswiki::Query::BinaryOP::::evaluatesToConstantFoswiki::Query::BinaryOP::evaluatesToConstant
411515411µs732µsFoswiki::Query::BinaryOP::::newFoswiki::Query::BinaryOP::new
111253µs318µsFoswiki::Query::BinaryOP::::BEGIN@6Foswiki::Query::BinaryOP::BEGIN@6
11123µs44µsFoswiki::Query::BinaryOP::::BEGIN@4Foswiki::Query::BinaryOP::BEGIN@4
11118µs35µsFoswiki::Query::BinaryOP::::BEGIN@40Foswiki::Query::BinaryOP::BEGIN@40
11117µs36µsFoswiki::Query::BinaryOP::::BEGIN@68Foswiki::Query::BinaryOP::BEGIN@68
11116µs25µsFoswiki::Query::BinaryOP::::BEGIN@5Foswiki::Query::BinaryOP::BEGIN@5
11115µs35µsFoswiki::Query::BinaryOP::::BEGIN@43Foswiki::Query::BinaryOP::BEGIN@43
11114µs33µsFoswiki::Query::BinaryOP::::BEGIN@71Foswiki::Query::BinaryOP::BEGIN@71
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2package Foswiki::Query::BinaryOP;
3
4249µs266µs
# spent 44µs (23+21) within Foswiki::Query::BinaryOP::BEGIN@4 which was called: # once (23µs+21µs) by Foswiki::Query::OP_match::BEGIN@14 at line 4
use strict;
# spent 44µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@4 # spent 21µs making 1 call to strict::import
5239µs233µs
# spent 25µs (16+8) within Foswiki::Query::BinaryOP::BEGIN@5 which was called: # once (16µs+8µs) by Foswiki::Query::OP_match::BEGIN@14 at line 5
use warnings;
# spent 25µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@5 # spent 8µs making 1 call to warnings::import
62420µs1318µs
# spent 318µs (253+65) within Foswiki::Query::BinaryOP::BEGIN@6 which was called: # once (253µs+65µs) by Foswiki::Query::OP_match::BEGIN@14 at line 6
use Foswiki::Query::OP;
# spent 318µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@6
7111µsour @ISA = ('Foswiki::Query::OP');
8
9
# spent 732µs (411+321) within Foswiki::Query::BinaryOP::new which was called 41 times, avg 18µs/call: # 3 times (56µs+36µs) by Foswiki::Query::OP_match::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_match.pm, avg 31µs/call # 3 times (29µs+24µs) by Foswiki::Query::OP_and::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_and.pm, avg 18µs/call # 3 times (28µs+22µs) by Foswiki::Query::OP_eq::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_eq.pm, avg 17µs/call # 3 times (28µs+22µs) by Foswiki::Query::OP_ref::new at line 21 of /var/www/foswiki11/lib/Foswiki/Query/OP_ref.pm, avg 17µs/call # 3 times (28µs+21µs) by Foswiki::Query::OP_lte::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_lte.pm, avg 17µs/call # 3 times (27µs+22µs) by Foswiki::Query::OP_lt::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_lt.pm, avg 16µs/call # 3 times (28µs+22µs) by Foswiki::Query::OP_like::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_like.pm, avg 16µs/call # 3 times (28µs+21µs) by Foswiki::Query::OP_gte::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_gte.pm, avg 16µs/call # 3 times (27µs+21µs) by Foswiki::Query::OP_gt::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_gt.pm, avg 16µs/call # 3 times (26µs+22µs) by Foswiki::Query::OP_where::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_where.pm, avg 16µs/call # 3 times (27µs+21µs) by Foswiki::Query::OP_ne::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_ne.pm, avg 16µs/call # 3 times (27µs+20µs) by Foswiki::Query::OP_dot::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_dot.pm, avg 16µs/call # 3 times (26µs+20µs) by Foswiki::Query::OP_or::new at line 19 of /var/www/foswiki11/lib/Foswiki/Query/OP_or.pm, avg 16µs/call # once (14µs+13µs) by Foswiki::If::OP_allows::new at line 22 of /var/www/foswiki11/lib/Foswiki/If/OP_allows.pm # once (11µs+13µs) by Foswiki::If::OP_ingroup::new at line 19 of /var/www/foswiki11/lib/Foswiki/If/OP_ingroup.pm
sub new {
104115µs my $class = shift;
1141414µs41320µs return $class->SUPER::new( arity => 2, @_ );
# spent 320µs making 41 calls to Foswiki::Query::OP::new, avg 8µs/call
12}
13
14# Determine if a string represents a valid number
15
# spent 36.9ms within Foswiki::Query::BinaryOP::_isNumber which was called 8767 times, avg 4µs/call: # 8767 times (36.9ms+0s) by Foswiki::Query::BinaryOP::compare at line 23, avg 4µs/call
sub _isNumber {
16876753.1ms return shift =~ m/^[+-]?(\d+\.\d+|\d+\.|\.\d+|\d+)([eE][+-]?\d+)?$/;
17}
18
19# Static function to apply a comparison function to two data, tolerant
20# of whether they are numeric or not
21
# spent 145ms (93.9+51.1) within Foswiki::Query::BinaryOP::compare which was called 8767 times, avg 17µs/call: # 8767 times (93.9ms+51.1ms) by Foswiki::Query::BinaryOP::evalTest at line 61, avg 17µs/call
sub compare {
2287675.40ms my ( $a, $b, $sub ) = @_;
2387679.88ms876736.9ms if ( _isNumber($a) && _isNumber($b) ) {
# spent 36.9ms making 8767 calls to Foswiki::Query::BinaryOP::_isNumber, avg 4µs/call
24 return &$sub( $a <=> $b );
25 }
26 else {
27876754.0ms876714.2ms return &$sub( $a cmp $b );
28 }
29}
30
31# Evaluate a node using the comparison function passed in. Extra parameters
32# are passed on to the comparison function.
33
# spent 1.56s (181ms+1.38) within Foswiki::Query::BinaryOP::evalTest which was called 8767 times, avg 178µs/call: # 8762 times (181ms+1.38s) by Foswiki::Query::OP_eq::evaluate at line 29 of /var/www/foswiki11/lib/Foswiki/Query/OP_eq.pm, avg 178µs/call # 5 times (90µs+2.25ms) by Foswiki::Query::OP_ne::evaluate at line 29 of /var/www/foswiki11/lib/Foswiki/Query/OP_ne.pm, avg 467µs/call
sub evalTest {
3487672.20ms my $this = shift;
3587671.39ms my $node = shift;
3687671.26ms my $clientData = shift;
3787671.26ms my $sub = shift;
3887675.20ms my $a = $node->{params}[0];
3987673.16ms my $b = $node->{params}[1];
40294µs252µs
# spent 35µs (18+17) within Foswiki::Query::BinaryOP::BEGIN@40 which was called: # once (18µs+17µs) by Foswiki::Query::OP_match::BEGIN@14 at line 40
no warnings 'recursion';
# spent 35µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@40 # spent 17µs making 1 call to warnings::unimport
41876711.8ms87670s my $ea = $a->evaluate( @{$clientData} );
# spent 1.02s making 8767 calls to Foswiki::Query::Node::evaluate, avg 117µs/call, recursion: max depth 2, sum of overlapping time 1.02s
42876716.6ms87670s my $eb = $b->evaluate( @{$clientData} );
# spent 215ms making 8767 calls to Foswiki::Query::Node::evaluate, avg 25µs/call, recursion: max depth 2, sum of overlapping time 215ms
432237µs256µs
# spent 35µs (15+20) within Foswiki::Query::BinaryOP::BEGIN@43 which was called: # once (15µs+20µs) by Foswiki::Query::OP_match::BEGIN@14 at line 43
use warnings 'recursion';
# spent 35µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@43 # spent 20µs making 1 call to warnings::import
4487671.90ms $ea = '' unless defined $ea;
4587671.30ms $eb = '' unless defined $eb;
46
4787673.96ms if ( ref($ea) eq 'ARRAY' ) {
48 my @res;
49 foreach my $lhs (@$ea) {
50 push( @res, $lhs ) if &$sub( $lhs, $eb, @_ );
51 }
52 if ( scalar(@res) == 0 ) {
53 return;
54 }
55 elsif ( scalar(@res) == 1 ) {
56 return $res[0];
57 }
58 return \@res;
59 }
60 else {
61876731.8ms8767145ms return &$sub( $ea, $eb, @_ );
# spent 145ms making 8767 calls to Foswiki::Query::BinaryOP::compare, avg 17µs/call
62 }
63}
64
65
# spent 938µs (634+304) within Foswiki::Query::BinaryOP::evaluatesToConstant which was called 120 times, avg 8µs/call: # 120 times (634µs+304µs) by Foswiki::Query::Node::evaluatesToConstant at line 218 of /var/www/foswiki11/lib/Foswiki/Query/Node.pm, avg 8µs/call
sub evaluatesToConstant {
6612035µs my $this = shift;
6712022µs my $node = shift;
68282µs256µs
# spent 36µs (17+19) within Foswiki::Query::BinaryOP::BEGIN@68 which was called: # once (17µs+19µs) by Foswiki::Query::OP_match::BEGIN@14 at line 68
no warnings 'recursion';
# spent 36µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@68 # spent 19µs making 1 call to warnings::unimport
69120445µs1200s return 0 unless $node->{params}[0]->evaluatesToConstant(@_);
# spent 304µs making 120 calls to Foswiki::Query::Node::evaluatesToConstant, avg 3µs/call, recursion: max depth 1, sum of overlapping time 304µs
70 return $node->{params}[1]->evaluatesToConstant(@_);
71263µs252µs
# spent 33µs (14+19) within Foswiki::Query::BinaryOP::BEGIN@71 which was called: # once (14µs+19µs) by Foswiki::Query::OP_match::BEGIN@14 at line 71
use warnings 'recursion';
# spent 33µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@71 # spent 19µs making 1 call to warnings::import
72}
73
7415µs1;
75__END__