Filename | /var/www/foswikidev/core/lib/Foswiki/Query/OP_or.pm |
Statements | Executed 21 statements in 284µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 1 | 1 | 34µs | 48µs | new | Foswiki::Query::OP_or::
1 | 1 | 1 | 16µs | 29µs | BEGIN@13 | Foswiki::Query::OP_or::
1 | 1 | 1 | 12µs | 515µs | evaluate | Foswiki::Query::OP_or::
1 | 1 | 1 | 10µs | 14µs | BEGIN@14 | Foswiki::Query::OP_or::
1 | 1 | 1 | 4µs | 4µs | BEGIN@16 | Foswiki::Query::OP_or::
0 | 0 | 0 | 0s | 0s | evaluatesToConstant | Foswiki::Query::OP_or::
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_or | ||||
6 | N-ary OR function. Given an expression like a OR b OR 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_or; | ||||
12 | |||||
13 | 2 | 29µs | 2 | 43µs | # spent 29µs (16+14) within Foswiki::Query::OP_or::BEGIN@13 which was called:
# once (16µs+14µs) by Foswiki::Query::Parser::BEGIN@34 at line 13 # spent 29µs making 1 call to Foswiki::Query::OP_or::BEGIN@13
# spent 14µs making 1 call to strict::import |
14 | 2 | 24µs | 2 | 18µs | # spent 14µs (10+4) within Foswiki::Query::OP_or::BEGIN@14 which was called:
# once (10µs+4µs) by Foswiki::Query::Parser::BEGIN@34 at line 14 # spent 14µs making 1 call to Foswiki::Query::OP_or::BEGIN@14
# spent 4µs making 1 call to warnings::import |
15 | |||||
16 | 2 | 179µs | 1 | 4µs | # spent 4µs within Foswiki::Query::OP_or::BEGIN@16 which was called:
# once (4µs+0s) by Foswiki::Query::Parser::BEGIN@34 at line 16 # spent 4µs making 1 call to Foswiki::Query::OP_or::BEGIN@16 |
17 | 1 | 6µs | our @ISA = ('Foswiki::Query::OP'); | ||
18 | |||||
19 | # spent 48µs (34+14) within Foswiki::Query::OP_or::new which was called 3 times, avg 16µs/call:
# 3 times (34µs+14µs) by Foswiki::Query::Parser::new at line 112 of /var/www/foswikidev/core/lib/Foswiki/Query/Parser.pm, avg 16µs/call | ||||
20 | 3 | 2µs | my $class = shift; | ||
21 | |||||
22 | # Treated as arity 2 for parsing, but folds to n-ary | ||||
23 | 3 | 29µs | 3 | 14µs | return $class->SUPER::new( # spent 14µs making 3 calls to Foswiki::Query::OP::new, avg 5µs/call |
24 | arity => 2, | ||||
25 | canfold => 1, | ||||
26 | name => 'or', | ||||
27 | prec => 100 | ||||
28 | ); | ||||
29 | } | ||||
30 | |||||
31 | # spent 515µs (12+503) within Foswiki::Query::OP_or::evaluate which was called:
# once (12µs+503µs) by Foswiki::Query::Node::evaluate at line 223 of /var/www/foswikidev/core/lib/Foswiki/Query/Node.pm | ||||
32 | 1 | 200ns | my $this = shift; | ||
33 | 1 | 100ns | my $node = shift; | ||
34 | 1 | 900ns | foreach my $i ( @{ $node->{params} } ) { | ||
35 | 3 | 8µs | 3 | 0s | return 1 if $i->evaluate(@_); # spent 503µs making 3 calls to Foswiki::Query::Node::evaluate, avg 168µs/call, recursion: max depth 1, sum of overlapping time 503µs |
36 | } | ||||
37 | 1 | 4µs | return 0; | ||
38 | } | ||||
39 | |||||
40 | sub evaluatesToConstant { | ||||
41 | my $this = shift; | ||||
42 | my $node = shift; | ||||
43 | my $all_const = 1; | ||||
44 | foreach my $i ( @{ $node->{params} } ) { | ||||
45 | my $ac = $i->evaluatesToConstant(@_); | ||||
46 | return 1 if $ac && $i->evaluate(@_); | ||||
47 | $all_const = 0 unless $ac; | ||||
48 | } | ||||
49 | return $all_const; | ||||
50 | } | ||||
51 | |||||
52 | 1 | 3µs | 1; | ||
53 | __END__ |