Filename | /var/www/foswiki11/lib/Foswiki/Query/Parser.pm |
Statements | Executed 204 statements in 2.73ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 3 | 3 | 21.9ms | 28.2ms | new | Foswiki::Query::Parser::
1 | 1 | 1 | 2.57ms | 4.41ms | BEGIN@17 | Foswiki::Query::Parser::
1 | 1 | 1 | 2.12ms | 2.78ms | BEGIN@20 | Foswiki::Query::Parser::
1 | 1 | 1 | 25µs | 48µs | BEGIN@13 | Foswiki::Query::Parser::
1 | 1 | 1 | 21µs | 46µs | BEGIN@15 | Foswiki::Query::Parser::
1 | 1 | 1 | 17µs | 26µs | BEGIN@14 | Foswiki::Query::Parser::
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::Parser | ||||
6 | |||||
7 | Parser for queries | ||||
8 | |||||
9 | =cut | ||||
10 | |||||
11 | package Foswiki::Query::Parser; | ||||
12 | |||||
13 | 2 | 47µs | 2 | 70µs | # spent 48µs (25+22) within Foswiki::Query::Parser::BEGIN@13 which was called:
# once (25µs+22µs) by Foswiki::If::Parser::BEGIN@16 at line 13 # spent 48µs making 1 call to Foswiki::Query::Parser::BEGIN@13
# spent 22µs making 1 call to strict::import |
14 | 2 | 47µs | 2 | 35µs | # spent 26µs (17+9) within Foswiki::Query::Parser::BEGIN@14 which was called:
# once (17µs+9µs) by Foswiki::If::Parser::BEGIN@16 at line 14 # spent 26µs making 1 call to Foswiki::Query::Parser::BEGIN@14
# spent 9µs making 1 call to warnings::import |
15 | 2 | 46µs | 2 | 70µs | # spent 46µs (21+24) within Foswiki::Query::Parser::BEGIN@15 which was called:
# once (21µs+24µs) by Foswiki::If::Parser::BEGIN@16 at line 15 # spent 46µs making 1 call to Foswiki::Query::Parser::BEGIN@15
# spent 24µs making 1 call to Assert::import |
16 | |||||
17 | 2 | 213µs | 1 | 4.41ms | # spent 4.41ms (2.57+1.84) within Foswiki::Query::Parser::BEGIN@17 which was called:
# once (2.57ms+1.84ms) by Foswiki::If::Parser::BEGIN@16 at line 17 # spent 4.41ms making 1 call to Foswiki::Query::Parser::BEGIN@17 |
18 | 1 | 26µs | our @ISA = ('Foswiki::Infix::Parser'); | ||
19 | |||||
20 | 2 | 398µs | 1 | 2.78ms | # spent 2.78ms (2.12+657µs) within Foswiki::Query::Parser::BEGIN@20 which was called:
# once (2.12ms+657µs) by Foswiki::If::Parser::BEGIN@16 at line 20 # spent 2.78ms making 1 call to Foswiki::Query::Parser::BEGIN@20 |
21 | |||||
22 | # Operators | ||||
23 | # | ||||
24 | # In the following, the standard InfixParser node structure is extended by | ||||
25 | # one field, 'exec'. | ||||
26 | # | ||||
27 | # exec is the name of a member function of the 'Query' class that evaluates | ||||
28 | # the node. It is called on the node and is passed a $domain. The $domain | ||||
29 | # is a reference to a hash that contains the data being operated on, and a | ||||
30 | # reference to the meta-data of the topic being worked on (this is | ||||
31 | # effectively the "topic object"). The data being operated on can be a | ||||
32 | # Meta object, a reference to an array (such as attachments), a reference | ||||
33 | # to a hash (such as TOPICINFO) or a scalar. Arrays can contain other arrays | ||||
34 | # and hashes. | ||||
35 | |||||
36 | # spent 28.2ms (21.9+6.31) within Foswiki::Query::Parser::new which was called 3 times, avg 9.41ms/call:
# once (20.7ms+5.18ms) by Foswiki::If::Parser::new at line 25 of /var/www/foswiki11/lib/Foswiki/If/Parser.pm
# once (723µs+655µs) by Foswiki::QUERY at line 47 of /var/www/foswiki11/lib/Foswiki/Macros/QUERY.pm
# once (532µs+474µs) by Foswiki::Search::parseSearch at line 119 of /var/www/foswiki11/lib/Foswiki/Search.pm | ||||
37 | 3 | 7µs | my ( $class, $options ) = @_; | ||
38 | |||||
39 | 3 | 16µs | $options->{words} ||= qr/([A-Z][A-Z0-9_:]*|({[A-Z][A-Z0-9_]*})+)/i; | ||
40 | 3 | 5µs | $options->{nodeClass} ||= 'Foswiki::Query::Node'; | ||
41 | 3 | 44µs | 3 | 61µs | my $this = $class->SUPER::new($options); # spent 61µs making 3 calls to Foswiki::Infix::Parser::new, avg 20µs/call |
42 | 3 | 5µs | die "{Operators}{Query} is undefined; re-run configure" | ||
43 | unless defined( $Foswiki::cfg{Operators}{Query} ); | ||||
44 | 3 | 9µs | foreach my $op ( @{ $Foswiki::cfg{Operators}{Query} } ) { | ||
45 | 57 | 1.30ms | eval "require $op"; # spent 135µs executing statements in 3 string evals (merged)
# spent 130µs executing statements in 3 string evals (merged)
# spent 116µs executing statements in 3 string evals (merged)
# spent 114µs executing statements in 3 string evals (merged)
# spent 110µs executing statements in 3 string evals (merged)
# spent 110µs executing statements in 3 string evals (merged)
# spent 109µs executing statements in 3 string evals (merged)
# spent 108µs executing statements in 3 string evals (merged)
# spent 106µs executing statements in 3 string evals (merged)
# spent 106µs executing statements in 3 string evals (merged)
# spent 105µs executing statements in 3 string evals (merged)
# spent 105µs executing statements in 3 string evals (merged)
# spent 104µs executing statements in 3 string evals (merged)
# spent 104µs executing statements in 3 string evals (merged)
# spent 103µs executing statements in 3 string evals (merged)
# spent 103µs executing statements in 3 string evals (merged)
# spent 103µs executing statements in 3 string evals (merged)
# spent 102µs executing statements in 3 string evals (merged)
# spent 96µs executing statements in 3 string evals (merged) | ||
46 | 57 | 112µs | 57 | 100µs | ASSERT( !$@, $@ ) if DEBUG; # spent 100µs making 57 calls to Assert::ASSERTS_OFF, avg 2µs/call |
47 | 57 | 434µs | 114 | 2.15ms | $this->addOperator( $op->new() ); # spent 175µs making 57 calls to Foswiki::Infix::Parser::addOperator, avg 3µs/call
# spent 150µs making 3 calls to Foswiki::Query::OP_match::new, avg 50µs/call
# spent 125µs making 3 calls to Foswiki::Query::OP_lc::new, avg 42µs/call
# spent 106µs making 3 calls to Foswiki::Query::OP_ref::new, avg 35µs/call
# spent 106µs making 3 calls to Foswiki::Query::OP_and::new, avg 35µs/call
# spent 104µs making 3 calls to Foswiki::Query::OP_not::new, avg 35µs/call
# spent 103µs making 3 calls to Foswiki::Query::OP_ob::new, avg 34µs/call
# spent 102µs making 3 calls to Foswiki::Query::OP_dot::new, avg 34µs/call
# spent 102µs making 3 calls to Foswiki::Query::OP_eq::new, avg 34µs/call
# spent 100µs making 3 calls to Foswiki::Query::OP_d2n::new, avg 33µs/call
# spent 100µs making 3 calls to Foswiki::Query::OP_lte::new, avg 33µs/call
# spent 100µs making 3 calls to Foswiki::Query::OP_length::new, avg 33µs/call
# spent 100µs making 3 calls to Foswiki::Query::OP_lt::new, avg 33µs/call
# spent 98µs making 3 calls to Foswiki::Query::OP_ne::new, avg 33µs/call
# spent 98µs making 3 calls to Foswiki::Query::OP_gt::new, avg 33µs/call
# spent 98µs making 3 calls to Foswiki::Query::OP_like::new, avg 33µs/call
# spent 98µs making 3 calls to Foswiki::Query::OP_gte::new, avg 32µs/call
# spent 97µs making 3 calls to Foswiki::Query::OP_where::new, avg 32µs/call
# spent 96µs making 3 calls to Foswiki::Query::OP_or::new, avg 32µs/call
# spent 95µs making 3 calls to Foswiki::Query::OP_uc::new, avg 32µs/call |
48 | } | ||||
49 | 3 | 19µs | return $this; | ||
50 | } | ||||
51 | |||||
52 | 1 | 5µs | 1; | ||
53 | __END__ |