← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:15 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Query/ConditionalOP.pm
StatementsExecuted 140366 statements in 170ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
876922116ms1.02sFoswiki::Query::ConditionalOP::::evalTestFoswiki::Query::ConditionalOP::evalTest
87691191.1ms141msFoswiki::Query::ConditionalOP::::compareFoswiki::Query::ConditionalOP::compare
2799211µs391µsFoswiki::Query::ConditionalOP::::newFoswiki::Query::ConditionalOP::new
11114µs25µsFoswiki::Query::ConditionalOP::::BEGIN@11Foswiki::Query::ConditionalOP::BEGIN@11
1119µs12µsFoswiki::Query::ConditionalOP::::BEGIN@12Foswiki::Query::ConditionalOP::BEGIN@12
1115µs5µsFoswiki::Query::ConditionalOP::::BEGIN@13Foswiki::Query::ConditionalOP::BEGIN@13
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::ConditionalOP;
3
4=begin TML
5
6---+ package Foswiki::Query::ConditionalOP
7Base class for binary conditional operators.
8
9=cut
10
11226µs237µs
# spent 25µs (14+12) within Foswiki::Query::ConditionalOP::BEGIN@11 which was called: # once (14µs+12µs) by Foswiki::Query::OP_lte::BEGIN@14 at line 11
use strict;
# spent 25µs making 1 call to Foswiki::Query::ConditionalOP::BEGIN@11 # spent 12µs making 1 call to strict::import
12222µs216µs
# spent 12µs (9+3) within Foswiki::Query::ConditionalOP::BEGIN@12 which was called: # once (9µs+3µs) by Foswiki::Query::OP_lte::BEGIN@14 at line 12
use warnings;
# spent 12µs making 1 call to Foswiki::Query::ConditionalOP::BEGIN@12 # spent 4µs making 1 call to warnings::import
132294µs15µs
# spent 5µs within Foswiki::Query::ConditionalOP::BEGIN@13 which was called: # once (5µs+0s) by Foswiki::Query::OP_lte::BEGIN@14 at line 13
use Foswiki::Query::OP;
# spent 5µs making 1 call to Foswiki::Query::ConditionalOP::BEGIN@13
1416µsour @ISA = ('Foswiki::Query::OP');
15
16
# spent 391µs (211+180) within Foswiki::Query::ConditionalOP::new which was called 27 times, avg 14µs/call: # 3 times (40µs+32µs) by Foswiki::Query::OP_match::new at line 26 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_match.pm, avg 24µs/call # 3 times (28µs+24µs) by Foswiki::Query::OP_gt::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_gt.pm, avg 17µs/call # 3 times (21µs+25µs) by Foswiki::Query::OP_ne::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_ne.pm, avg 15µs/call # 3 times (21µs+19µs) by Foswiki::Query::OP_like::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_like.pm, avg 13µs/call # 3 times (21µs+18µs) by Foswiki::Query::OP_eq::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_eq.pm, avg 13µs/call # 3 times (20µs+16µs) by Foswiki::Query::OP_lte::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_lte.pm, avg 12µs/call # 3 times (21µs+15µs) by Foswiki::Query::OP_in::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_in.pm, avg 12µs/call # 3 times (20µs+16µs) by Foswiki::Query::OP_gte::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_gte.pm, avg 12µs/call # 3 times (20µs+15µs) by Foswiki::Query::OP_lt::new at line 19 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_lt.pm, avg 12µs/call
sub new {
17277µs my $class = shift;
1827209µs27180µs return $class->SUPER::new( arity => 2, @_ );
# spent 180µs making 27 calls to Foswiki::Query::OP::new, avg 7µs/call
19}
20
21=begin TML
22
23---++ StaticMethod compare($a, $b, \&fn) -> $boolean
24
25Apply a binary comparison function to two data, tolerant
26of whether they are numeric or not. =\&fn= takes a single parameter,
27which is the result of a =<=>= comparison on =$a= and =$b=. The result
28of applying =\&fn= is returned.
29
30=cut
31
32
# spent 141ms (91.1+49.7) within Foswiki::Query::ConditionalOP::compare which was called 8769 times, avg 16µs/call: # 8769 times (91.1ms+49.7ms) by Foswiki::Query::ConditionalOP::evalTest at line 88, avg 16µs/call
sub compare {
3387694.63ms my ( $a, $b, $sub ) = @_;
3487692.79ms if ( !defined($a) ) {
35 return &$sub(0) unless defined($b);
36 return -&$sub(1);
37 }
38 elsif ( !defined($b) ) {
39 return &$sub(1);
40 }
4187699.43ms876936.4ms if ( Foswiki::Query::OP::isNumber($a)
# spent 36.4ms making 8769 calls to Foswiki::Query::OP::isNumber, avg 4µs/call
42 && Foswiki::Query::OP::isNumber($b) )
43 {
44 return &$sub( $a <=> $b );
45 }
46 else {
47876945.8ms876913.3ms return &$sub( $a cmp $b );
48 }
49}
50
51=begin TML
52
53---++ ObjectMethod evalTest($node, $clientData, \&fn) -> $result
54Evaluate a node using the comparison function passed in. Extra parameters
55are passed on to the comparison function. If the LHS of the node
56evaluates to an array, the result will be an array made by
57applying =\&fn= to each member of the LHS array. The RHS is passed on
58untouched to \&fn. Thus =(1,-1) > 1= will yield (1,0)
59
60=cut
61
62
# spent 1.02s (116ms+900ms) within Foswiki::Query::ConditionalOP::evalTest which was called 8769 times, avg 116µs/call: # 8763 times (116ms+898ms) by Foswiki::Query::OP_eq::evaluate at line 29 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_eq.pm, avg 116µs/call # 6 times (62µs+1.15ms) by Foswiki::Query::OP_ne::evaluate at line 29 of /var/www/foswikidev/core/lib/Foswiki/Query/OP_ne.pm, avg 202µs/call
sub evalTest {
6387691.64ms my $this = shift;
6487691.18ms my $node = shift;
6587691.08ms my $clientData = shift;
668769880µs my $sub = shift;
6787694.10ms my $a = $node->{params}[0];
6887692.29ms my $b = $node->{params}[1];
69876910.7ms87690s my $ea = $a->evaluate( @{$clientData} );
# spent 722ms making 8769 calls to Foswiki::Query::Node::evaluate, avg 82µs/call, recursion: max depth 2, sum of overlapping time 722ms
70876913.5ms87690s my $eb = $b->evaluate( @{$clientData} );
# spent 36.9ms making 8769 calls to Foswiki::Query::Node::evaluate, avg 4µs/call, recursion: max depth 2, sum of overlapping time 36.9ms
7187691.34ms $ea = '' unless defined $ea;
728769737µs $eb = '' unless defined $eb;
73
7487693.03ms if ( ref($ea) eq 'ARRAY' ) {
75 my @res;
76 foreach my $lhs (@$ea) {
77 push( @res, $lhs ) if &$sub( $lhs, $eb, @_ );
78 }
79 if ( scalar(@res) == 0 ) {
80 return;
81 }
82 elsif ( scalar(@res) == 1 ) {
83 return $res[0];
84 }
85 return \@res;
86 }
87 else {
88876966.2ms8769141ms return &$sub( $ea, $eb, @_ );
# spent 141ms making 8769 calls to Foswiki::Query::ConditionalOP::compare, avg 16µs/call
89 }
90}
91
9213µs1;
93__END__