← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:10 2015

Filename/var/www/foswiki11/lib/Foswiki/Query/Node.pm
StatementsExecuted 444941 statements in 1.16s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
264331281.04s2.00sFoswiki::Query::Node::::evaluateFoswiki::Query::Node::evaluate (recurses: max depth 2, inclusive time 1.24s)
1145229296.3ms96.3msFoswiki::Query::Node::::MONITOR_EVALFoswiki::Query::Node::MONITOR_EVAL
242322.79ms5.95msFoswiki::Query::Node::::simplifyFoswiki::Query::Node::simplify (recurses: max depth 1, inclusive time 3.09ms)
320322.44ms2.74msFoswiki::Query::Node::::toStringFoswiki::Query::Node::toString (recurses: max depth 4, inclusive time 5.69ms)
140311.93ms3.51msFoswiki::Query::Node::::newLeafFoswiki::Query::Node::newLeaf
403331.24ms1.87msFoswiki::Query::Node::::evaluatesToConstantFoswiki::Query::Node::evaluatesToConstant (recurses: max depth 1, inclusive time 304µs)
11133µs51µsFoswiki::Query::Node::::BEGIN@101Foswiki::Query::Node::BEGIN@101
11124µs48µsFoswiki::Query::Node::::BEGIN@29Foswiki::Query::Node::BEGIN@29
11119µs36µsFoswiki::Query::Node::::BEGIN@183Foswiki::Query::Node::BEGIN@183
11118µs37µsFoswiki::Query::Node::::BEGIN@185Foswiki::Query::Node::BEGIN@185
11117µs48µsFoswiki::Query::Node::::BEGIN@117Foswiki::Query::Node::BEGIN@117
11117µs33µsFoswiki::Query::Node::::BEGIN@217Foswiki::Query::Node::BEGIN@217
11116µs31µsFoswiki::Query::Node::::BEGIN@239Foswiki::Query::Node::BEGIN@239
11116µs40µsFoswiki::Query::Node::::BEGIN@34Foswiki::Query::Node::BEGIN@34
11116µs37µsFoswiki::Query::Node::::BEGIN@258Foswiki::Query::Node::BEGIN@258
11115µs25µsFoswiki::Query::Node::::BEGIN@30Foswiki::Query::Node::BEGIN@30
11115µs224µsFoswiki::Query::Node::::BEGIN@35Foswiki::Query::Node::BEGIN@35
11115µs34µsFoswiki::Query::Node::::BEGIN@219Foswiki::Query::Node::BEGIN@219
1118µs8µsFoswiki::Query::Node::::BEGIN@37Foswiki::Query::Node::BEGIN@37
1117µs7µsFoswiki::Query::Node::::BEGIN@31Foswiki::Query::Node::BEGIN@31
Call graph for these subroutines as a Graphviz dot language file.
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::Node
6
7A Query object is a representation of a query over the Foswiki database.
8
9Fields are given by name, and values by strings or numbers. Strings should always be surrounded by 'single-quotes'. Numbers can be signed integers or decimals. Single quotes in values may be escaped using backslash (\).
10
11See %SYSTEMWEB%.QuerySearch for details of the query language. At the time of writing
12only a subset of the entire query language is supported, for use in searching.
13
14A query object implements the =evaluate= method as its general
15contract with the rest of the world. This method does a "hard work" evaluation
16of the parser tree. Of course, smarter Store implementations should be
17able to do it better....
18
19The "hard work" evaluation uses the =getField= method in the
20{Store}{QueryAlgorithm} to get data from the store. This decouples the query
21object from the detail of the store.
22
23See Foswiki::Store::QueryAlgorithms for a full spec of the interface to
24query algorithms.
25
26=cut
27
28package Foswiki::Query::Node;
29248µs271µs
# spent 48µs (24+24) within Foswiki::Query::Node::BEGIN@29 which was called: # once (24µs+24µs) by Foswiki::Query::Parser::BEGIN@20 at line 29
use strict;
# spent 48µs making 1 call to Foswiki::Query::Node::BEGIN@29 # spent 24µs making 1 call to strict::import
30242µs234µs
# spent 25µs (15+10) within Foswiki::Query::Node::BEGIN@30 which was called: # once (15µs+10µs) by Foswiki::Query::Parser::BEGIN@20 at line 30
use warnings;
# spent 25µs making 1 call to Foswiki::Query::Node::BEGIN@30 # spent 10µs making 1 call to warnings::import
31262µs17µs
# spent 7µs within Foswiki::Query::Node::BEGIN@31 which was called: # once (7µs+0s) by Foswiki::Query::Parser::BEGIN@20 at line 31
use Foswiki::Infix::Node ();
# spent 7µs making 1 call to Foswiki::Query::Node::BEGIN@31
32115µsour @ISA = ('Foswiki::Infix::Node');
33
34246µs263µs
# spent 40µs (16+24) within Foswiki::Query::Node::BEGIN@34 which was called: # once (16µs+24µs) by Foswiki::Query::Parser::BEGIN@20 at line 34
use Assert;
# spent 40µs making 1 call to Foswiki::Query::Node::BEGIN@34 # spent 24µs making 1 call to Assert::import
35251µs2433µs
# spent 224µs (15+209) within Foswiki::Query::Node::BEGIN@35 which was called: # once (15µs+209µs) by Foswiki::Query::Parser::BEGIN@20 at line 35
use Error qw( :try );
# spent 224µs making 1 call to Foswiki::Query::Node::BEGIN@35 # spent 209µs making 1 call to Error::import
36
372383µs18µs
# spent 8µs within Foswiki::Query::Node::BEGIN@37 which was called: # once (8µs+0s) by Foswiki::Query::Parser::BEGIN@20 at line 37
use Foswiki::Meta ();
# spent 8µs making 1 call to Foswiki::Query::Node::BEGIN@37
38
39# Cache of the names of $Foswiki::cfg items that are accessible
401200nsour $isAccessibleCfg;
41
42=begin TML
43
44---++ PUBLIC %aliases
45A hash mapping short aliases for META: entry names. For example, this hash
46maps 'form' to 'META:FORM'. Published because extensions (search
47implementations) have made use of it in the past, though not part of the
48offical API.
49
50This hash is maintained by Foswiki::Meta and is *strictly read-only*
51
52---++ PUBLIC %isArrayType
53Maps META: entry type names to true if the type is an array type (such as
54FIELD, ATTACHMENT or PREFERENCE). Published because extensions (search
55implementations) have made use of it in the past, though not part of the
56offical API. The type name should be given without the leading 'META:'
57
58This hash is maintained by Foswiki::Meta and is *strictly read-only*
59
60=cut
61
62# These used to be declared here, but have been refactored back into
63# Foswiki::Meta
6412µs*aliases = \%Foswiki::Meta::aliases;
651400ns*isArrayType = \%Foswiki::Meta::isArrayType;
66
67# <DEBUG SUPPORT>
68
69114522428ms
# spent 96.3ms within Foswiki::Query::Node::MONITOR_EVAL which was called 114522 times, avg 841ns/call: # 26433 times (23.7ms+0s) by Foswiki::Query::Node::evaluate at line 189, avg 897ns/call # 26433 times (20.4ms+0s) by Foswiki::Query::Node::evaluate at line 148, avg 772ns/call # 8852 times (7.41ms+0s) by Foswiki::Query::Node::evaluate at line 176, avg 837ns/call # 8821 times (9.02ms+0s) by Foswiki::Query::Node::evaluate at line 186, avg 1µs/call # 8821 times (7.02ms+0s) by Foswiki::Query::Node::evaluate at line 181, avg 796ns/call # 8821 times (6.30ms+0s) by Foswiki::Query::Node::evaluate at line 187, avg 714ns/call # 8821 times (5.78ms+0s) by Foswiki::Query::Node::evaluate at line 182, avg 656ns/call # 8760 times (9.10ms+0s) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 240 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 1µs/call # 8760 times (7.52ms+0s) by Foswiki::Query::Node::evaluate at line 155, avg 858ns/call
sub MONITOR_EVAL { 0 }
70
71# We expand config vars to constant strings during the parse, because otherwise we'd
72# have to export the knowledge of config vars out to other engines that may
73# evaluate queries instead of the default evaluator.
74
# spent 3.51ms (1.93+1.58) within Foswiki::Query::Node::newLeaf which was called 140 times, avg 25µs/call: # 81 times (1.41ms+1.09ms) by Foswiki::Infix::Parser::__ANON__[/var/www/foswiki11/lib/Foswiki/Infix/Parser.pm:277] at line 253 of /var/www/foswiki11/lib/Foswiki/Infix/Parser.pm, avg 31µs/call # 58 times (499µs+464µs) by Foswiki::Infix::Parser::__ANON__[/var/www/foswiki11/lib/Foswiki/Infix/Parser.pm:277] at line 239 of /var/www/foswiki11/lib/Foswiki/Infix/Parser.pm, avg 17µs/call # once (20µs+23µs) by Foswiki::Infix::Parser::__ANON__[/var/www/foswiki11/lib/Foswiki/Infix/Parser.pm:277] at line 246 of /var/www/foswiki11/lib/Foswiki/Infix/Parser.pm
sub newLeaf {
75140202µs my ( $class, $val, $type ) = @_;
76
77140253µs if ( $type == $Foswiki::Infix::Node::NAME
78 && $val =~ /^({[A-Z][A-Z0-9_]*})+$/i )
79 {
80
81 # config var name, make sure it's accessible.
8214µs unless ( defined $isAccessibleCfg ) {
83 $isAccessibleCfg =
84170µs { map { $_ => 1 } @{ $Foswiki::cfg{AccessibleCFG} } };
85 }
86 $val =
87134µs ( $isAccessibleCfg->{$val} ) ? eval( '$Foswiki::cfg' . $val ) : '';
# spent 3µs executing statements in string eval
88115µs121µs return $class->SUPER::newLeaf( $val, $Foswiki::Infix::Node::STRING );
# spent 21µs making 1 call to Foswiki::Infix::Node::newLeaf
89 }
90 else {
911391.42ms1391.56ms return $class->SUPER::newLeaf( $val, $type );
# spent 1.56ms making 139 calls to Foswiki::Infix::Node::newLeaf, avg 11µs/call
92 }
93}
94
95
# spent 2.74ms (2.44+299µs) within Foswiki::Query::Node::toString which was called 320 times, avg 9µs/call: # 160 times (940µs+-940µs) by Foswiki::Query::Node::toString at line 110, avg 0s/call # 120 times (1.03ms+-1.03ms) by Foswiki::Query::Node::toString at line 102, avg 0s/call # 40 times (466µs+2.27ms) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 184 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 68µs/call
sub toString {
9632085µs my $a = shift;
9732044µs return 'undef' unless defined($a);
98
99 # Suppress the recursion check; the tree can easily be more than
100 # 100 levels deep.
1012210µs270µs
# spent 51µs (33+18) within Foswiki::Query::Node::BEGIN@101 which was called: # once (33µs+18µs) by Foswiki::Query::Parser::BEGIN@20 at line 101
no warnings 'recursion';
# spent 51µs making 1 call to Foswiki::Query::Node::BEGIN@101 # spent 18µs making 1 call to warnings::unimport
1023201.40ms440244µs if ( UNIVERSAL::isa( $a, 'Foswiki::Query::Node' ) ) {
# spent 244µs making 320 calls to UNIVERSAL::isa, avg 764ns/call # spent 3.39ms making 120 calls to Foswiki::Query::Node::toString, avg 28µs/call, recursion: max depth 3, sum of overlapping time 3.39ms
103 return
104 '{ op => '
105 . $a->{op}
106 . ', params => '
107 . toString( $a->{params} ) . ' }';
108 }
109200117µs if ( ref($a) eq 'ARRAY' ) {
110280674µs1600s return '[' . join( ',', map { toString($_) } @$a ) . ']';
# spent 2.30ms making 160 calls to Foswiki::Query::Node::toString, avg 14µs/call, recursion: max depth 4, sum of overlapping time 2.30ms
111 }
1128022µs if ( ref($a) eq 'HASH' ) {
113 return
114 '{'
115 . join( ',', map { "$_=>" . toString( $a->{$_} ) } keys %$a ) . '}';
116 }
1172454µs279µs
# spent 48µs (17+31) within Foswiki::Query::Node::BEGIN@117 which was called: # once (17µs+31µs) by Foswiki::Query::Parser::BEGIN@20 at line 117
use warnings 'recursion';
# spent 48µs making 1 call to Foswiki::Query::Node::BEGIN@117 # spent 31µs making 1 call to warnings::import
11880196µs8055µs if ( UNIVERSAL::isa( $a, 'Foswiki::Meta' ) ) {
# spent 55µs making 80 calls to UNIVERSAL::isa, avg 686ns/call
119 return $a->stringify();
120 }
12180196µs return $a;
122}
123
1241500nsmy $ind = 0;
125
126# </DEBUG SUPPORT>
127
128# Evaluate this node by invoking the operator function named in the 'exec'
129# field of the operator. The return result is either an array ref (for many
130# results) or a scalar (for a single result)
131#
132# This is the default evaluator for queries. However it may not be the only
133# engine that evaluates them; external engines, such as SQL, might be delegated
134# the responsibility of evaluating queries in a search context.
135#
136# Note that the name resolution simply executes the getField function in the
137# query algorithm. It is placed there to allow for Store specific optimisations
138# such as direct database lookups.
139#
140# SMELL: is the getField passed enough domain information? It can see the data
141# object (usually a Meta) but cannot see the context of the name in the query.
142#
143
# spent 2.00s (1.04+957ms) within Foswiki::Query::Node::evaluate which was called 26433 times, avg 76µs/call: # 8767 times (186ms+-186ms) by Foswiki::Query::BinaryOP::evalTest at line 42 of /var/www/foswiki11/lib/Foswiki/Query/BinaryOP.pm, avg 0s/call # 8767 times (539ms+-539ms) by Foswiki::Query::BinaryOP::evalTest at line 41 of /var/www/foswiki11/lib/Foswiki/Query/BinaryOP.pm, avg 0s/call # 8760 times (316ms+1.67s) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 242 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 227µs/call # 82 times (1.12ms+246µs) by Foswiki::Query::Node::simplify at line 241, avg 17µs/call # 41 times (1.05ms+10.5ms) by Foswiki::__ANON__[/var/www/foswiki11/lib/Foswiki/Macros/IF.pm:43] at line 35 of /var/www/foswiki11/lib/Foswiki/Macros/IF.pm, avg 280µs/call # 6 times (132µs+-132µs) by Foswiki::Query::OP_and::evaluate at line 27 of /var/www/foswiki11/lib/Foswiki/Query/OP_and.pm, avg 0s/call # 4 times (109µs+-109µs) by Foswiki::Query::OP_and::evaluate at line 29 of /var/www/foswiki11/lib/Foswiki/Query/OP_and.pm, avg 0s/call # 2 times (57µs+-57µs) by Foswiki::Query::OP_or::evaluate at line 27 of /var/www/foswiki11/lib/Foswiki/Query/OP_or.pm, avg 0s/call # once (33µs+8µs) by Foswiki::__ANON__[/var/www/foswiki11/lib/Foswiki/Macros/QUERY.pm:56] at line 53 of /var/www/foswiki11/lib/Foswiki/Macros/QUERY.pm # once (19µs+4µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 117 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm # once (27µs+-27µs) by Foswiki::Query::OP_or::evaluate at line 29 of /var/www/foswiki11/lib/Foswiki/Query/OP_or.pm # once (24µs+-24µs) by Foswiki::Query::OP_not::evaluate at line 26 of /var/www/foswiki11/lib/Foswiki/Query/OP_not.pm
sub evaluate {
144264336.47ms my $this = shift;
1452643338.6ms2643323.5ms ASSERT( scalar(@_) % 2 == 0 );
# spent 23.5ms making 26433 calls to Assert::dummyASSERT, avg 889ns/call
146264333.84ms my $result;
147
1482643329.7ms2643320.4ms print STDERR ( '-' x $ind ) . $this->stringify() if MONITOR_EVAL;
# spent 20.4ms making 26433 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 772ns/call
149
1502643325.9ms if ( !ref( $this->{op} ) ) {
1511761223.7ms my %domain = @_;
1521761230.1ms if ( $this->{op} == $Foswiki::Infix::Node::NAME
153 && defined $domain{data} )
154 {
15587608.79ms87607.52ms print STDERR '.' if MONITOR_EVAL;
# spent 7.52ms making 8760 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 858ns/call
156876012.9ms if ( lc( $this->{params}[0] ) eq 'now' ) {
157 $result = time();
158 }
159 elsif ( lc( $this->{params}[0] ) eq 'undefined' ) {
160 $result = undef;
161 }
162 else {
163
164 # a name; look it up in $domain{data}
1658760227ms eval "require $Foswiki::cfg{Store}{QueryAlgorithm}";
# spent 21.9ms executing statements in 8760 string evals (merged)
16687601.46ms if ($@) {
167 print STDERR ' BOOM ' if MONITOR_EVAL;
168 die $@;
169 }
170 $result =
171876045.5ms8760448ms $Foswiki::cfg{Store}{QueryAlgorithm}
# spent 448ms making 8760 calls to Foswiki::Store::QueryAlgorithms::BruteForce::getField, avg 51µs/call
172 ->getField( $this, $domain{data}, $this->{params}[0] );
173 }
174 }
175 else {
17688528.86ms88527.41ms print STDERR ',' if MONITOR_EVAL;
# spent 7.41ms making 8852 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 837ns/call
17788526.88ms $result = $this->{params}[0];
178 }
179 }
180 else {
18188218.84ms88217.02ms print STDERR " {\n" if MONITOR_EVAL;
# spent 7.02ms making 8821 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 796ns/call
18288217.52ms88215.78ms $ind++ if MONITOR_EVAL;
# spent 5.78ms making 8821 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 656ns/call
183274µs252µs
# spent 36µs (19+17) within Foswiki::Query::Node::BEGIN@183 which was called: # once (19µs+17µs) by Foswiki::Query::Parser::BEGIN@20 at line 183
no warnings 'recursion';
# spent 36µs making 1 call to Foswiki::Query::Node::BEGIN@183 # spent 17µs making 1 call to warnings::unimport
184882139.7ms88211.64s $result = $this->{op}->evaluate( $this, @_ );
# spent 1.62s making 8762 calls to Foswiki::Query::OP_eq::evaluate, avg 185µs/call # spent 6.96ms making 18 calls to Foswiki::If::OP_dollar::evaluate, avg 387µs/call # spent 2.58ms making 6 calls to Foswiki::Query::OP_and::evaluate, avg 429µs/call # spent 2.40ms making 5 calls to Foswiki::Query::OP_ne::evaluate, avg 479µs/call # spent 923µs making 12 calls to Foswiki::If::OP_defined::evaluate, avg 77µs/call # spent 856µs making 7 calls to Foswiki::If::OP_istopic::evaluate, avg 122µs/call # spent 1.41ms making 2 calls to Foswiki::Query::OP_or::evaluate, avg 703µs/call, recursion: max depth 1, sum of overlapping time 683µs # spent 259µs making 8 calls to Foswiki::If::OP_context::evaluate, avg 32µs/call # spent 70µs making 1 call to Foswiki::Query::OP_not::evaluate
1852253µs256µs
# spent 37µs (18+19) within Foswiki::Query::Node::BEGIN@185 which was called: # once (18µs+19µs) by Foswiki::Query::Parser::BEGIN@20 at line 185
use warnings 'recursion';
# spent 37µs making 1 call to Foswiki::Query::Node::BEGIN@185 # spent 19µs making 1 call to warnings::import
186882112.1ms88219.02ms $ind-- if MONITOR_EVAL;
# spent 9.02ms making 8821 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 1µs/call
187882110.8ms88216.30ms print STDERR ( '-' x $ind ) . '}' . $this->{op}->{name} if MONITOR_EVAL;
# spent 6.30ms making 8821 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 714ns/call
188 }
1892643328.0ms2643323.7ms print STDERR ' -> ' . toString($result) . "\n" if MONITOR_EVAL;
# spent 23.7ms making 26433 calls to Foswiki::Query::Node::MONITOR_EVAL, avg 897ns/call
190
19126433142ms return $result;
192}
193
194=begin TML
195
196---++ evaluatesToConstant(%opts)
197
198Determine if this node evaluates to a constant or not. "Constant" is defined
199as "anything that doesn't involve actually looking in searched topics".
200This function takes the same parameters (%domain) as evaluate(). Note that
201no reference to the tom or data web or topic will be made, so you can
202simply pass an arbitrary Foswiki::Meta.
203
204=cut
205
206
# spent 1.87ms (1.24+634µs) within Foswiki::Query::Node::evaluatesToConstant which was called 403 times, avg 5µs/call: # 242 times (780µs+740µs) by Foswiki::Query::Node::simplify at line 240, avg 6µs/call # 120 times (304µs+-304µs) by Foswiki::Query::BinaryOP::evaluatesToConstant at line 69 of /var/www/foswiki11/lib/Foswiki/Query/BinaryOP.pm, avg 0s/call # 41 times (155µs+199µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 110 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 9µs/call
sub evaluatesToConstant {
20740373µs my $this = shift;
208403572µs if (
209 !ref( $this->{op} )
210 && ( $this->{op} == $Foswiki::Infix::Node::NUMBER
211 || $this->{op} == $Foswiki::Infix::Node::STRING )
212 )
213 {
214 return 1;
215 }
216 elsif ( ref( $this->{op} ) ) {
217267µs249µs
# spent 33µs (17+16) within Foswiki::Query::Node::BEGIN@217 which was called: # once (17µs+16µs) by Foswiki::Query::Parser::BEGIN@20 at line 217
no warnings 'recursion';
# spent 33µs making 1 call to Foswiki::Query::Node::BEGIN@217 # spent 16µs making 1 call to warnings::unimport
218120476µs120938µs return $this->{op}->evaluatesToConstant( $this, @_ );
# spent 938µs making 120 calls to Foswiki::Query::BinaryOP::evaluatesToConstant, avg 8µs/call
2192117µs253µs
# spent 34µs (15+19) within Foswiki::Query::Node::BEGIN@219 which was called: # once (15µs+19µs) by Foswiki::Query::Parser::BEGIN@20 at line 219
use warnings 'recursion';
# spent 34µs making 1 call to Foswiki::Query::Node::BEGIN@219 # spent 19µs making 1 call to warnings::import
220 }
221200479µs return 0;
222}
223
224=begin TML
225
226---++ simplify(%opts)
227
228Simplify the query by spotting constant expressions and evaluating them,
229replacing the constant expression with an atomic value in the expression tree.
230This function takes the same parameters (%domain) as evaluate(). Note that
231no reference to the tom or data web or topic will be made, so you can
232simply pass an arbitrary Foswiki::Meta.
233
234=cut
235
236
# spent 5.95ms (2.79+3.16) within Foswiki::Query::Node::simplify which was called 242 times, avg 25µs/call: # 160 times (1.47ms+-1.47ms) by Foswiki::Query::Node::simplify at line 253, avg 0s/call # 41 times (814µs+2.76ms) by Foswiki::Store::QueryAlgorithms::BruteForce::query at line 48 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 87µs/call # 41 times (502µs+1.87ms) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 109 of /var/www/foswiki11/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm, avg 58µs/call
sub simplify {
23724264µs my $this = shift;
238
2392240µs246µs
# spent 31µs (16+15) within Foswiki::Query::Node::BEGIN@239 which was called: # once (16µs+15µs) by Foswiki::Query::Parser::BEGIN@20 at line 239
no warnings 'recursion';
# spent 31µs making 1 call to Foswiki::Query::Node::BEGIN@239 # spent 15µs making 1 call to warnings::unimport
240242810µs2421.52ms if ( $this->evaluatesToConstant(@_) ) {
# spent 1.52ms making 242 calls to Foswiki::Query::Node::evaluatesToConstant, avg 6µs/call
24182156µs821.37ms my $c = $this->evaluate(@_);
# spent 1.37ms making 82 calls to Foswiki::Query::Node::evaluate, avg 17µs/call
2428234µs $c = 0 unless defined $c;
24382279µs if ( $c =~ /^[+-]?(\d+\.\d+|\d+\.|\.\d+|\d+)([eE][+-]?\d+)?$/ ) {
244 $this->{op} = $Foswiki::Infix::Node::NUMBER;
245 }
246 else {
2478062µs $this->{op} = $Foswiki::Infix::Node::STRING;
248 }
24982158µs @{ $this->{params} } = ($c);
250 }
251 else {
252160205µs for my $f ( @{ $this->{params} } ) {
2532401.05ms400273µs if ( UNIVERSAL::can( $f, 'simplify' ) ) {
# spent 273µs making 240 calls to UNIVERSAL::can, avg 1µs/call # spent 3.09ms making 160 calls to Foswiki::Query::Node::simplify, avg 19µs/call, recursion: max depth 1, sum of overlapping time 3.09ms
254 $f->simplify(@_);
255 }
256 }
257 }
258275µs258µs
# spent 37µs (16+21) within Foswiki::Query::Node::BEGIN@258 which was called: # once (16µs+21µs) by Foswiki::Query::Parser::BEGIN@20 at line 258
use warnings 'recursion';
# spent 37µs making 1 call to Foswiki::Query::Node::BEGIN@258 # spent 21µs making 1 call to warnings::import
259}
260
26117µs1;
262__END__