Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/OP_or.pm |
Statements | Executed 22 statements in 552µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 1 | 1 | 103µs | 147µs | new | Foswiki::Query::OP_or::
1 | 1 | 1 | 46µs | 1.89ms | evaluate | Foswiki::Query::OP_or::
1 | 1 | 1 | 25µs | 33µs | BEGIN@13 | Foswiki::Query::OP_or::
1 | 1 | 1 | 17µs | 36µs | BEGIN@14 | Foswiki::Query::OP_or::
1 | 1 | 1 | 10µs | 10µ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 | 49µs | 2 | 41µs | # spent 33µs (25+8) within Foswiki::Query::OP_or::BEGIN@13 which was called:
# once (25µs+8µs) by Foswiki::Query::Parser::BEGIN@27 at line 13 # spent 33µs making 1 call to Foswiki::Query::OP_or::BEGIN@13
# spent 8µs making 1 call to strict::import |
14 | 2 | 44µs | 2 | 55µs | # spent 36µs (17+19) within Foswiki::Query::OP_or::BEGIN@14 which was called:
# once (17µs+19µs) by Foswiki::Query::Parser::BEGIN@27 at line 14 # spent 36µs making 1 call to Foswiki::Query::OP_or::BEGIN@14
# spent 19µs making 1 call to warnings::import |
15 | |||||
16 | 2 | 302µs | 1 | 10µs | # spent 10µs within Foswiki::Query::OP_or::BEGIN@16 which was called:
# once (10µs+0s) by Foswiki::Query::Parser::BEGIN@27 at line 16 # spent 10µs making 1 call to Foswiki::Query::OP_or::BEGIN@16 |
17 | 1 | 9µs | our @ISA = ('Foswiki::Query::OP'); | ||
18 | |||||
19 | # spent 147µs (103+44) within Foswiki::Query::OP_or::new which was called 3 times, avg 49µs/call:
# 3 times (103µs+44µs) by Foswiki::Query::Parser::new at line 105 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/Parser.pm, avg 49µs/call | ||||
20 | 6 | 94µs | my $class = shift; | ||
21 | |||||
22 | # Treated as arity 2 for parsing, but folds to n-ary | ||||
23 | 3 | 44µs | return $class->SUPER::new( # spent 44µs making 3 calls to Foswiki::Query::OP::new, avg 15µs/call | ||
24 | arity => 2, | ||||
25 | canfold => 1, | ||||
26 | name => 'or', | ||||
27 | prec => 100 | ||||
28 | ); | ||||
29 | } | ||||
30 | |||||
31 | # spent 1.89ms (46µs+1.85) within Foswiki::Query::OP_or::evaluate which was called:
# once (46µs+1.85ms) by Foswiki::Query::Node::evaluate at line 223 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/Node.pm | ||||
32 | 4 | 16µs | my $this = shift; | ||
33 | my $node = shift; | ||||
34 | 1 | 2µs | foreach my $i ( @{ $node->{params} } ) { | ||
35 | 3 | 31µs | 3 | 0s | return 1 if $i->evaluate(@_); # spent 1.85ms making 3 calls to Foswiki::Query::Node::evaluate, avg 616µs/call, recursion: max depth 1, sum of overlapping time 1.85ms |
36 | } | ||||
37 | 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 | 6µs | 1; | ||
53 | __END__ |