Filename | /var/www/foswikidev/core/lib/Foswiki/Query/OP_and.pm |
Statements | Executed 52 statements in 309µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
8 | 1 | 1 | 58µs | 1.85ms | evaluate | Foswiki::Query::OP_and::
3 | 1 | 1 | 35µs | 50µs | new | Foswiki::Query::OP_and::
1 | 1 | 1 | 15µs | 28µs | BEGIN@13 | Foswiki::Query::OP_and::
1 | 1 | 1 | 10µs | 14µs | BEGIN@14 | Foswiki::Query::OP_and::
1 | 1 | 1 | 4µs | 4µs | BEGIN@16 | Foswiki::Query::OP_and::
0 | 0 | 0 | 0s | 0s | evaluatesToConstant | Foswiki::Query::OP_and::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | |||||
3 | =begin TML | ||||
4 | |||||
5 | ---+ package Foswiki::Query::OP_and | ||||
6 | N-ary AND function. Given an expression like a AND b AND c, this operator | ||||
7 | will build a single node that has 3 parameters, a, b, and c. | ||||
8 | |||||
9 | =cut | ||||
10 | |||||
11 | package Foswiki::Query::OP_and; | ||||
12 | |||||
13 | 2 | 28µs | 2 | 41µs | # spent 28µs (15+13) within Foswiki::Query::OP_and::BEGIN@13 which was called:
# once (15µs+13µs) by Foswiki::Query::Parser::BEGIN@36 at line 13 # spent 28µs making 1 call to Foswiki::Query::OP_and::BEGIN@13
# spent 13µs making 1 call to strict::import |
14 | 2 | 24µs | 2 | 18µs | # spent 14µs (10+4) within Foswiki::Query::OP_and::BEGIN@14 which was called:
# once (10µs+4µs) by Foswiki::Query::Parser::BEGIN@36 at line 14 # spent 14µs making 1 call to Foswiki::Query::OP_and::BEGIN@14
# spent 4µs making 1 call to warnings::import |
15 | |||||
16 | 2 | 164µs | 1 | 4µs | # spent 4µs within Foswiki::Query::OP_and::BEGIN@16 which was called:
# once (4µs+0s) by Foswiki::Query::Parser::BEGIN@36 at line 16 # spent 4µs making 1 call to Foswiki::Query::OP_and::BEGIN@16 |
17 | 1 | 8µs | our @ISA = ('Foswiki::Query::OP'); | ||
18 | |||||
19 | # spent 50µs (35+15) within Foswiki::Query::OP_and::new which was called 3 times, avg 17µs/call:
# 3 times (35µs+15µs) by Foswiki::Query::Parser::new at line 112 of /var/www/foswikidev/core/lib/Foswiki/Query/Parser.pm, avg 17µs/call | ||||
20 | 3 | 2µs | my $class = shift; | ||
21 | |||||
22 | # Treated as arity 2 for parsing, but folds to n-ary | ||||
23 | 3 | 31µs | 3 | 15µs | return $class->SUPER::new( # spent 15µs making 3 calls to Foswiki::Query::OP::new, avg 5µs/call |
24 | arity => 2, | ||||
25 | canfold => 1, | ||||
26 | name => 'and', | ||||
27 | prec => 200 | ||||
28 | ); | ||||
29 | } | ||||
30 | |||||
31 | # spent 1.85ms (58µs+1.79) within Foswiki::Query::OP_and::evaluate which was called 8 times, avg 231µs/call:
# 8 times (58µs+1.79ms) by Foswiki::Query::Node::evaluate at line 223 of /var/www/foswikidev/core/lib/Foswiki/Query/Node.pm, avg 231µs/call | ||||
32 | 8 | 2µs | my $this = shift; | ||
33 | 8 | 1µs | my $node = shift; | ||
34 | 8 | 8µs | foreach my $i ( @{ $node->{params} } ) { | ||
35 | 12 | 34µs | 12 | 0s | return 0 unless $i->evaluate(@_); # spent 1.79ms making 12 calls to Foswiki::Query::Node::evaluate, avg 149µs/call, recursion: max depth 1, sum of overlapping time 1.79ms |
36 | } | ||||
37 | 2 | 5µs | return 1; | ||
38 | } | ||||
39 | |||||
40 | sub evaluatesToConstant { | ||||
41 | my $this = shift; | ||||
42 | my $node = shift; | ||||
43 | foreach my $i ( @{ $node->{params} } ) { | ||||
44 | return 0 unless $i->evaluatesToConstant(@_); | ||||
45 | return 1 unless $i->evaluate(@_); | ||||
46 | } | ||||
47 | return 1; | ||||
48 | } | ||||
49 | |||||
50 | 1 | 3µs | 1; | ||
51 | __END__ |