Filename | /var/www/foswiki11/lib/Foswiki/Query/BinaryOP.pm |
Statements | Executed 140730 statements in 206ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
8767 | 2 | 2 | 181ms | 1.56s | evalTest | Foswiki::Query::BinaryOP::
8767 | 1 | 1 | 93.9ms | 145ms | compare | Foswiki::Query::BinaryOP::
8767 | 1 | 1 | 36.9ms | 36.9ms | _isNumber | Foswiki::Query::BinaryOP::
120 | 1 | 1 | 634µs | 938µs | evaluatesToConstant | Foswiki::Query::BinaryOP::
41 | 15 | 15 | 411µs | 732µs | new | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 253µs | 318µs | BEGIN@6 | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 23µs | 44µs | BEGIN@4 | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 18µs | 35µs | BEGIN@40 | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 17µs | 36µs | BEGIN@68 | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 16µs | 25µs | BEGIN@5 | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 15µs | 35µs | BEGIN@43 | Foswiki::Query::BinaryOP::
1 | 1 | 1 | 14µs | 33µs | BEGIN@71 | Foswiki::Query::BinaryOP::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki::Query::BinaryOP; | ||||
3 | |||||
4 | 2 | 49µs | 2 | 66µ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 # spent 44µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@4
# spent 21µs making 1 call to strict::import |
5 | 2 | 39µs | 2 | 33µ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 # spent 25µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@5
# spent 8µs making 1 call to warnings::import |
6 | 2 | 420µs | 1 | 318µ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 # spent 318µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@6 |
7 | 1 | 11µs | our @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 | ||||
10 | 41 | 15µs | my $class = shift; | ||
11 | 41 | 414µs | 41 | 320µ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 | ||||
16 | 8767 | 53.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 | ||||
22 | 8767 | 5.40ms | my ( $a, $b, $sub ) = @_; | ||
23 | 8767 | 9.88ms | 8767 | 36.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 { | ||||
27 | 8767 | 54.0ms | 8767 | 14.2ms | return &$sub( $a cmp $b ); # spent 14.2ms making 8762 calls to Foswiki::Query::OP_eq::__ANON__[/var/www/foswiki11/lib/Foswiki/Query/OP_eq.pm:28], avg 2µs/call
# spent 10µs making 5 calls to Foswiki::Query::OP_ne::__ANON__[/var/www/foswiki11/lib/Foswiki/Query/OP_ne.pm:28], avg 2µs/call |
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 | ||||
34 | 8767 | 2.20ms | my $this = shift; | ||
35 | 8767 | 1.39ms | my $node = shift; | ||
36 | 8767 | 1.26ms | my $clientData = shift; | ||
37 | 8767 | 1.26ms | my $sub = shift; | ||
38 | 8767 | 5.20ms | my $a = $node->{params}[0]; | ||
39 | 8767 | 3.16ms | my $b = $node->{params}[1]; | ||
40 | 2 | 94µs | 2 | 52µ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 # spent 35µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@40
# spent 17µs making 1 call to warnings::unimport |
41 | 8767 | 11.8ms | 8767 | 0s | 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 |
42 | 8767 | 16.6ms | 8767 | 0s | 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 |
43 | 2 | 237µs | 2 | 56µ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 # spent 35µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@43
# spent 20µs making 1 call to warnings::import |
44 | 8767 | 1.90ms | $ea = '' unless defined $ea; | ||
45 | 8767 | 1.30ms | $eb = '' unless defined $eb; | ||
46 | |||||
47 | 8767 | 3.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 { | ||||
61 | 8767 | 31.8ms | 8767 | 145ms | 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 | ||||
66 | 120 | 35µs | my $this = shift; | ||
67 | 120 | 22µs | my $node = shift; | ||
68 | 2 | 82µs | 2 | 56µ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 # spent 36µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@68
# spent 19µs making 1 call to warnings::unimport |
69 | 120 | 445µs | 120 | 0s | 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(@_); | ||||
71 | 2 | 63µs | 2 | 52µ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 # spent 33µs making 1 call to Foswiki::Query::BinaryOP::BEGIN@71
# spent 19µs making 1 call to warnings::import |
72 | } | ||||
73 | |||||
74 | 1 | 5µs | 1; | ||
75 | __END__ |