← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:26:35 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/Node.pm
StatementsExecuted 1894 statements in 11.9ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
150875.17ms28.5msFoswiki::Query::Node::::evaluateFoswiki::Query::Node::evaluate (recurses: max depth 2, inclusive time 16.1ms)
115312.78ms6.68msFoswiki::Query::Node::::newLeafFoswiki::Query::Node::newLeaf
111739µs1.65msFoswiki::Query::Node::::BEGIN@75Foswiki::Query::Node::BEGIN@75
6011201µs201µsFoswiki::Query::Node::::CORE:matchFoswiki::Query::Node::CORE:match (opcode)
2211123µs123µsFoswiki::Query::Node::::tokensFoswiki::Query::Node::tokens
22270µs288µsFoswiki::Query::Node::::simplifyFoswiki::Query::Node::simplify
21159µs127µsFoswiki::Query::Node::::_freezeFoswiki::Query::Node::_freeze
32235µs35µsFoswiki::Query::Node::::evaluatesToConstantFoswiki::Query::Node::evaluatesToConstant
11126µs33µsFoswiki::Query::Node::::BEGIN@29Foswiki::Query::Node::BEGIN@29
11121µs64µsFoswiki::Query::Node::::BEGIN@93Foswiki::Query::Node::BEGIN@93
11117µs35µsFoswiki::Query::Node::::BEGIN@30Foswiki::Query::Node::BEGIN@30
11116µs54µsFoswiki::Query::Node::::BEGIN@34Foswiki::Query::Node::BEGIN@34
11116µs374µsFoswiki::Query::Node::::BEGIN@35Foswiki::Query::Node::BEGIN@35
11116µs68µsFoswiki::Query::Node::::BEGIN@109Foswiki::Query::Node::BEGIN@109
11115µs108µsFoswiki::Query::Node::::BEGIN@41Foswiki::Query::Node::BEGIN@41
11115µs103µsFoswiki::Query::Node::::BEGIN@42Foswiki::Query::Node::BEGIN@42
11110µs10µsFoswiki::Query::Node::::BEGIN@37Foswiki::Query::Node::BEGIN@37
11110µs10µsFoswiki::Query::Node::::BEGIN@31Foswiki::Query::Node::BEGIN@31
1114µs4µsFoswiki::Query::Node::::isEmptyFoswiki::Query::Node::isEmpty
0000s0sFoswiki::Query::Node::::_getFieldFoswiki::Query::Node::_getField
0000s0sFoswiki::Query::Node::::_makeArrayFoswiki::Query::Node::_makeArray
0000s0sFoswiki::Query::Node::::emptyExpressionFoswiki::Query::Node::emptyExpression
0000s0sFoswiki::Query::Node::::toStringFoswiki::Query::Node::toString
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 Node object is a single node in a query (either a tree node or a leaf node).
8A tree of node objects represents a query over the Foswiki database.
9
10Fields are given by name, and values by strings or numbers.
11
12A query object implements the =evaluate= method as its general
13contract with the rest of the world. This method is a "reference implementation" -
14it does a brute force evaluation of the expression represented by the node in a given
15data domain. It is expected that smarter store implementations will analyse the parse tree
16and derive as many optimisations as possible, minimising fallback to this brute force
17evaluation.
18
19The reference implementation of evaluation uses the =getField= method in the
20{Store}{QueryAlgorithm} to get data from the store. This further decouples the query
21object from the detail of the store implementation.
22
23See Foswiki::Store::QueryAlgorithms for a full spec of the interface to
24query algorithms.
25
26=cut
27
28package Foswiki::Query::Node;
29251µs241µs
# spent 33µs (26+8) within Foswiki::Query::Node::BEGIN@29 which was called: # once (26µs+8µs) by Foswiki::Infix::Node::BEGIN@124 at line 29
use strict;
# spent 33µs making 1 call to Foswiki::Query::Node::BEGIN@29 # spent 8µs making 1 call to strict::import
30243µs253µs
# spent 35µs (17+18) within Foswiki::Query::Node::BEGIN@30 which was called: # once (17µs+18µs) by Foswiki::Infix::Node::BEGIN@124 at line 30
use warnings;
# spent 35µs making 1 call to Foswiki::Query::Node::BEGIN@30 # spent 18µs making 1 call to warnings::import
31259µs110µs
# spent 10µs within Foswiki::Query::Node::BEGIN@31 which was called: # once (10µs+0s) by Foswiki::Infix::Node::BEGIN@124 at line 31
use Foswiki::Infix::Node ();
# spent 10µs making 1 call to Foswiki::Query::Node::BEGIN@31
32110µsour @ISA = ('Foswiki::Infix::Node');
33
34247µs292µs
# spent 54µs (16+38) within Foswiki::Query::Node::BEGIN@34 which was called: # once (16µs+38µs) by Foswiki::Infix::Node::BEGIN@124 at line 34
use Assert;
# spent 54µs making 1 call to Foswiki::Query::Node::BEGIN@34 # spent 38µs making 1 call to Assert::import
35248µs2732µs
# spent 374µs (16+358) within Foswiki::Query::Node::BEGIN@35 which was called: # once (16µs+358µs) by Foswiki::Infix::Node::BEGIN@124 at line 35
use Error qw( :try );
# spent 374µs making 1 call to Foswiki::Query::Node::BEGIN@35 # spent 358µs making 1 call to Error::import
36
37246µs110µs
# spent 10µs within Foswiki::Query::Node::BEGIN@37 which was called: # once (10µs+0s) by Foswiki::Infix::Node::BEGIN@124 at line 37
use Foswiki::Meta ();
# spent 10µs making 1 call to Foswiki::Query::Node::BEGIN@37
38
39# <DEBUG SUPPORT>
40
41247µs2200µs
# spent 108µs (15+92) within Foswiki::Query::Node::BEGIN@41 which was called: # once (15µs+92µs) by Foswiki::Infix::Node::BEGIN@124 at line 41
use constant MONITOR_EVAL => 0;
# spent 108µs making 1 call to Foswiki::Query::Node::BEGIN@41 # spent 93µs making 1 call to constant::import
422236µs2190µs
# spent 103µs (15+87) within Foswiki::Query::Node::BEGIN@42 which was called: # once (15µs+87µs) by Foswiki::Infix::Node::BEGIN@124 at line 42
use constant MONITOR_FOLD => 0;
# spent 103µs making 1 call to Foswiki::Query::Node::BEGIN@42 # spent 87µs making 1 call to constant::import
43
44# Cache of the names of $Foswiki::cfg items that are accessible
4511µsour $isAccessibleCfg;
46
47=begin TML
48
49---++ PUBLIC %aliases
50A hash mapping short aliases for META: entry names. For example, this hash
51maps 'form' to 'META:FORM'. Published because extensions (search
52implementations) have made use of it in the past, though not part of the
53offical API.
54
55This hash is maintained by Foswiki::Meta and is *strictly read-only*
56
57---++ PUBLIC %isArrayType
58Maps META: entry type names to true if the type is an array type (such as
59FIELD, ATTACHMENT or PREFERENCE). Published because extensions (search
60implementations) have made use of it in the past, though not part of the
61offical API. The type name should be given without the leading 'META:'
62
63This hash is maintained by Foswiki::Meta and is *strictly read-only*
64
65=cut
66
67# These used to be declared here, but have been refactored back into
68# Foswiki::Meta
6912µs*aliases = \%Foswiki::Meta::aliases;
7011µs*isArrayType = \%Foswiki::Meta::isArrayType;
71
7211µsour $emptyExprOp;
731800nsour $commaOp;
74
75
# spent 1.65ms (739µs+915µs) within Foswiki::Query::Node::BEGIN@75 which was called: # once (739µs+915µs) by Foswiki::Infix::Node::BEGIN@124 at line 80
BEGIN {
764223µs require Foswiki::Query::OP_empty;
77154µs $emptyExprOp = Foswiki::Query::OP_empty->new();
# spent 54µs making 1 call to Foswiki::Query::OP_empty::new
78 require Foswiki::Query::OP_comma;
79150µs $commaOp = Foswiki::Query::OP_comma->new();
# spent 50µs making 1 call to Foswiki::Query::OP_comma::new
801106µs11.65ms}
# spent 1.65ms making 1 call to Foswiki::Query::Node::BEGIN@75
81
82sub emptyExpression {
83 my $this = shift;
84 return $this->newNode($emptyExprOp);
85}
86
87sub toString {
88 my $a = shift;
89 return 'undef' unless defined($a);
90
91 # Suppress the recursion check; the tree can easily be more than
92 # 100 levels deep.
932198µs2108µs
# spent 64µs (21+43) within Foswiki::Query::Node::BEGIN@93 which was called: # once (21µs+43µs) by Foswiki::Infix::Node::BEGIN@124 at line 93
no warnings 'recursion';
# spent 64µs making 1 call to Foswiki::Query::Node::BEGIN@93 # spent 43µs making 1 call to warnings::unimport
94 if ( UNIVERSAL::isa( $a, 'Foswiki::Query::Node' ) ) {
95 return
96 '{ op => '
97 . $a->{op}
98 . ', params => '
99 . toString( $a->{params} ) . ' }';
100 }
101 if ( ref($a) eq 'ARRAY' ) {
102 return '[' . join( ',', map { toString($_) } @$a ) . ']';
103 }
104 if ( ref($a) eq 'HASH' ) {
105 return
106 '{'
107 . join( ',', map { "$_=>" . toString( $a->{$_} ) } keys %$a ) . '}';
108 }
10922.34ms2121µs
# spent 68µs (16+52) within Foswiki::Query::Node::BEGIN@109 which was called: # once (16µs+52µs) by Foswiki::Infix::Node::BEGIN@124 at line 109
use warnings 'recursion';
# spent 68µs making 1 call to Foswiki::Query::Node::BEGIN@109 # spent 52µs making 1 call to warnings::import
110 if ( UNIVERSAL::isa( $a, 'Foswiki::Meta' ) ) {
111 return $a->stringify();
112 }
113 return $a;
114}
115
11612µsmy $ind = 0;
117
118# </DEBUG SUPPORT>
119
120# STATIC overrides Foswiki::Infix::Node
121# We expand config vars to constant strings during the parse, because
122# otherwise we'd have to export the knowledge of config vars out to other
123# engines that may evaluate queries instead of the default evaluator.
124
# spent 6.68ms (2.78+3.90) within Foswiki::Query::Node::newLeaf which was called 115 times, avg 58µs/call: # 60 times (1.65ms+2.04ms) by Foswiki::Infix::Parser::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Infix/Parser.pm:299] at line 269 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Infix/Parser.pm, avg 62µs/call # 54 times (1.11ms+1.80ms) by Foswiki::Infix::Parser::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Infix/Parser.pm:299] at line 253 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Infix/Parser.pm, avg 54µs/call # once (23µs+63µs) by Foswiki::Infix::Parser::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Infix/Parser.pm:299] at line 261 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Infix/Parser.pm
sub newLeaf {
1254082.99ms my ( $class, $val, $type ) = @_;
126
12760201µs if ( $type == Foswiki::Infix::Node::NAME
# spent 201µs making 60 calls to Foswiki::Query::Node::CORE:match, avg 3µs/call
128 && $val =~ /^({[A-Z][A-Z0-9_]*})+$/i )
129 {
130
131 # config var name, make sure it's accessible.
132 unless ( defined $isAccessibleCfg ) {
133 $isAccessibleCfg =
134 { map { $_ => 1 } @{ $Foswiki::cfg{AccessibleCFG} } };
135 }
136 $val =
137 ( $isAccessibleCfg->{$val} ) ? eval( '$Foswiki::cfg' . $val ) : '';
# spent 6µs executing statements in string eval
138142µs return $class->SUPER::newLeaf( $val, Foswiki::Infix::Node::STRING );
# spent 42µs making 1 call to Foswiki::Infix::Node::newLeaf
139 }
140 else {
1411143.66ms return $class->SUPER::newLeaf( $val, $type );
# spent 3.66ms making 114 calls to Foswiki::Infix::Node::newLeaf, avg 32µs/call
142 }
143}
144
145=begin TML
146
147---++ ObjectMethod evaluate(...) -> $result
148
149Evaluate this node by invoking the =evaluate= method of the attached operator.
150The return result is either an array ref (for many results) or a scalar (for a
151single result)
152
153This is the reference evaluator for queries. However it may not be the only
154engine that evaluates them; external engines, such as SQL, might be delegated
155the responsibility of evaluating queries in a search context.
156
157Name resolution depends on the context in which the name is used. A name
158on the LHS of the dot and where operators may only be a form name, or a META:
159name, referred to as a "restricted name". A name anywhere else can be
160a META: name, a field name, or one of the shortcuts (such as "web", "name"
161etc). Fields and forms are looked up by calling the =getField= and
162=getForm= methods in the query engine respectively.
163
164=cut
165
166
# spent 28.5ms (5.17+23.3) within Foswiki::Query::Node::evaluate which was called 150 times, avg 190µs/call: # 75 times (2.80ms+25.5ms) by Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/IF.pm:43] at line 35 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/IF.pm, avg 378µs/call # 24 times (835µs+-835µs) by Foswiki::Query::OP_and::evaluate at line 35 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/OP_and.pm, avg 0s/call # 22 times (666µs+-666µs) by Foswiki::Query::ConditionalOP::evalTest at line 69 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/ConditionalOP.pm, avg 0s/call # 22 times (610µs+-610µs) by Foswiki::Query::ConditionalOP::evalTest at line 70 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/ConditionalOP.pm, avg 0s/call # 3 times (106µs+-106µs) by Foswiki::Query::OP_or::evaluate at line 35 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/OP_or.pm, avg 0s/call # 2 times (58µs+10µs) by Foswiki::Query::Node::simplify at line 348, avg 34µs/call # once (54µs+9µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 81 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm # once (41µs+7µs) by Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/QUERY.pm:56] at line 54 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/QUERY.pm
sub evaluate {
16714005.19ms my $this = shift;
168150582µs ASSERT( scalar(@_) % 2 == 0 );
# spent 582µs making 150 calls to Assert::dummyASSERT, avg 4µs/call
169 my $result;
170
171 print STDERR ( ' ' x $ind ) . $this->stringify() if MONITOR_EVAL;
172
173 if ( !ref( $this->{op} ) ) {
174 my %domain = @_;
175 if ( $this->{op} == Foswiki::Infix::Node::NAME
176 && defined $domain{data} )
177 {
178 print STDERR ' NAME' if MONITOR_EVAL;
179 if ( lc( $this->{params}[0] ) eq 'now' ) {
180 $result = time();
181 }
182 elsif ( lc( $this->{params}[0] ) eq 'undefined' ) {
183 $result = undef;
184 }
185 else {
186
187 # a name; either the form name or a field name.
188 # Look it up in $domain{data}
189 eval "require $Foswiki::cfg{Store}{QueryAlgorithm}";
190 if ($@) {
191 print STDERR ' BOOM ' if MONITOR_EVAL;
192 die $@;
193 }
194 my $name = $this->{params}[0];
195 my $realname = $Foswiki::Meta::aliases{$name} || $name;
196 if ( $domain{restricted_name} && $realname !~ /^META:/ ) {
197
198 # Only a form name and META: expressions are
199 # legal on the LHS of a dot or where expression
200 print STDERR " form $name" if MONITOR_EVAL;
201 $result =
202 $Foswiki::cfg{Store}{QueryAlgorithm}
203 ->getForm( $this, $domain{data}, $name );
204 }
205 else {
206 print STDERR " field $name" if MONITOR_EVAL;
207 $name = $realname
208 if UNIVERSAL::isa( $domain{data}, 'Foswiki::Meta' );
209 $result = $this->_getField( $domain{data}, $name );
210 }
211 }
212 }
213 else {
214 print STDERR ' constant' if MONITOR_EVAL;
215 $result = $this->{params}[0];
216 }
217 }
218 else {
219 print STDERR " {\n" if MONITOR_EVAL;
220 $ind++ if MONITOR_EVAL;
221 my %params = @_;
222 delete $params{no_fields}; # kill semaphore
22310038.8ms $result = $this->{op}->evaluate( $this, %params );
# spent 13.5ms making 15 calls to Foswiki::If::OP_dollar::evaluate, avg 899µs/call # spent 6.47ms making 13 calls to Foswiki::Query::OP_and::evaluate, avg 498µs/call # spent 6.31ms making 12 calls to Foswiki::Query::OP_ne::evaluate, avg 526µs/call # spent 4.64ms making 10 calls to Foswiki::Query::OP_eq::evaluate, avg 464µs/call # spent 2.29ms making 10 calls to Foswiki::If::OP_defined::evaluate, avg 229µs/call # spent 1.92ms making 6 calls to Foswiki::If::OP_istopic::evaluate, avg 320µs/call # spent 1.89ms making 1 call to Foswiki::Query::OP_or::evaluate # spent 1.81ms making 33 calls to Foswiki::If::OP_context::evaluate, avg 55µs/call
224 $ind-- if MONITOR_EVAL;
225 print STDERR ( ' ' x $ind ) . '}' . $this->{op}->{name}
226 if MONITOR_EVAL;
227 }
228 if (MONITOR_EVAL) {
229 print STDERR ' -> ' . toString($result);
230 my %domain = @_;
231 print STDERR " IN " . $domain{tom}->getPath() . "\n"
232 if ref( $domain{tom} ) && !$ind;
233 print STDERR "\n";
234 }
235 return $result;
236}
237
238# Private method to fetch field values
239sub _getField {
240 my ( $this, $data, $name ) = @_;
241
242 if ( UNIVERSAL::isa( $data, 'Foswiki::Meta' ) ) {
243
244 # If the data is a Foswiki::Meta, pass on to the query algorithm
245 return $Foswiki::cfg{Store}{QueryAlgorithm}
246 ->getField( $this, $data, $name );
247 }
248
249 if ( ref($data) eq 'ARRAY' ) {
250
251 # Array objects are returned during evaluation, e.g. when
252 # a subset of an array is matched for further processing.
253
254 # Indexing an array object. The index will be one of:
255 # 1. An integer, which is an implicit index='x' query
256 # 2. A name, which is an implicit name='x' query
257 if ( $name =~ /^\d+$/ ) {
258
259 # Integer index
260 return $data->[$name];
261 }
262
263 # String index
264 my @res;
265
266 # Get all array entries that match the field
267 foreach my $f (@$data) {
268 my $val = $this->_getField( $f, $name );
269 push( @res, $val ) if defined($val);
270 }
271 return \@res if ( scalar(@res) );
272
273 # The field name wasn't explicitly seen in any of the records.
274 # Try again, this time matching 'name' and returning 'value'
275 foreach my $f (@$data) {
276 next unless ref($f) eq 'HASH';
277 if ( $f->{name}
278 && $f->{name} eq $name
279 && defined $f->{value} )
280 {
281 push( @res, $f->{value} );
282 }
283 }
284 return \@res if ( scalar(@res) );
285 return undef;
286 }
287
288 if ( ref($data) eq 'HASH' ) {
289
290 # A hash object may be returned when a sub-object of a Foswiki::Meta
291 # object has been matched.
292 return $data->{ $this->{params}[0] };
293 }
294
295 # Last ditch - treat it as a constant
296 return $this->{params}[0];
297}
298
299=begin TML
300
301---++ ObjectMethod evaluatesToConstant(%opts)
302
303Support for expression optimisation/hoisting.
304
305Determine if this node evaluates to a constant or not. "Constant" is defined
306as "anything that doesn't involve actually looking in searched topics".
307This function takes the same parameters (%domain) as evaluate(). Note that
308no reference to the tom or data web or topic will be made, so you can
309simply pass an arbitrary Foswiki::Meta.
310
311=cut
312
313
# spent 35µs within Foswiki::Query::Node::evaluatesToConstant which was called 3 times, avg 12µs/call: # 2 times (24µs+0s) by Foswiki::Query::Node::simplify at line 347, avg 12µs/call # once (11µs+0s) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 74 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm
sub evaluatesToConstant {
3141547µs my $this = shift;
315 my $c = 0;
316 if ( ref( $this->{op} ) ) {
317 $c = $this->{op}->evaluatesToConstant( $this, @_ );
318 }
319 elsif ( $this->{op} == Foswiki::Infix::Node::NUMBER ) {
320 $c = 1;
321 }
322 elsif ( $this->{op} == Foswiki::Infix::Node::STRING ) {
323 $c = 1;
324 }
325 print STDERR $this->stringify() . " is "
326 . ( $c ? '' : 'not ' )
327 . "constant\n"
328 if MONITOR_FOLD;
329 return $c;
330}
331
332=begin TML
333
334---++ ObjectMethod simplify(%opts)
335
336Simplify the query by spotting constant expressions and evaluating them,
337replacing the constant expression with an atomic value in the expression tree.
338This function takes the same parameters (%domain) as evaluate(). Note that
339no reference to the tom or data web or topic will be made, so you can
340simply pass an arbitrary Foswiki::Meta.
341
342=cut
343
344
# spent 288µs (70+218) within Foswiki::Query::Node::simplify which was called 2 times, avg 144µs/call: # once (44µs+134µs) by Foswiki::Store::Interfaces::QueryAlgorithm::query at line 87 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/Interfaces/QueryAlgorithm.pm # once (27µs+85µs) by Foswiki::Store::QueryAlgorithms::BruteForce::_webQuery at line 72 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/QueryAlgorithms/BruteForce.pm
sub simplify {
3451062µs my $this = shift;
346
347224µs if ( $this->evaluatesToConstant(@_) ) {
# spent 24µs making 2 calls to Foswiki::Query::Node::evaluatesToConstant, avg 12µs/call
348267µs my $c = $this->evaluate(@_);
# spent 67µs making 2 calls to Foswiki::Query::Node::evaluate, avg 34µs/call
349 $c = 0 unless defined $c;
3502127µs $this->_freeze($c);
# spent 127µs making 2 calls to Foswiki::Query::Node::_freeze, avg 63µs/call
351 }
352 else {
353 for my $f ( @{ $this->{params} } ) {
354 if ( UNIVERSAL::can( $f, 'simplify' ) ) {
355 $f->simplify(@_);
356 }
357 }
358 }
359}
360
361
# spent 127µs (59+68) within Foswiki::Query::Node::_freeze which was called 2 times, avg 63µs/call: # 2 times (59µs+68µs) by Foswiki::Query::Node::simplify at line 350, avg 63µs/call
sub _freeze {
362655µs my ( $this, $c ) = @_;
363
364246µs if ( ref($c) eq 'ARRAY' ) {
# spent 46µs making 2 calls to Foswiki::Query::OP::isNumber, avg 23µs/call
365 $this->_makeArray($c);
366 }
367 elsif ( ref($c) eq 'HASH' ) {
368 $this->convertToLeaf( Foswiki::Infix::Node::HASH, $c );
369 }
370 elsif ( ref($c) eq 'Foswiki::Meta' ) {
371 $this->convertToLeaf( Foswiki::Infix::Node::META, $c );
372 }
373 elsif ( Foswiki::Query::OP::isNumber($c) ) {
374222µs $this->convertToLeaf( Foswiki::Infix::Node::NUMBER, $c );
# spent 22µs making 2 calls to Foswiki::Infix::Node::convertToLeaf, avg 11µs/call
375 }
376 else {
377
378 #Item10703: can't convert a non-scalar to a STRING without further processing.
379 if ( ref($c) eq '' ) {
380 $this->convertToLeaf( Foswiki::Infix::Node::STRING, $c );
381 }
382 else {
383 print STDERR "_freeze" . ref($c) . "\n" if MONITOR_FOLD;
384 }
385 }
386}
387
388sub _makeArray {
389 my ( $this, $array ) = @_;
390 if ( scalar(@$array) == 0 ) {
391 $this->{op} = $emptyExprOp;
392 }
393 elsif ( scalar(@$array) == 1 ) {
394 die unless defined $array->[0];
395 $this->_freeze( $array->[0] );
396 }
397 else {
398 $this->{op} = $commaOp;
399 $this->{params}[0] = Foswiki::Query::Node->newNode($commaOp);
400 $this->{params}[0]->_freeze( shift(@$array) );
401 $this->{params}[1] = Foswiki::Query::Node->newNode($commaOp);
402 $this->{params}[1]->_freeze($array);
403 }
404}
405
406=begin TML
407
408---++ ObjectMethod tokens() -> []
409Provided for compatibility with Foswiki::Search::Node
410
411=cut
412
413
# spent 123µs within Foswiki::Query::Node::tokens which was called 22 times, avg 6µs/call: # 22 times (123µs+0s) by Foswiki::Search::formatResults at line 943 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Search.pm, avg 6µs/call
sub tokens {
41422124µs return [];
415}
416
417=begin TML
418
419---++ ObjectMethod isEmpty() -> $boolean
420Provided for compatibility with Foswiki::Search::Node
421
422=cut
423
424
# spent 4µs within Foswiki::Query::Node::isEmpty which was called: # once (4µs+0s) by Foswiki::Store::Interfaces::QueryAlgorithm::query at line 77 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/Interfaces/QueryAlgorithm.pm
sub isEmpty {
425110µs return 0;
426}
427
42818µs1;
429__END__
 
# spent 201µs within Foswiki::Query::Node::CORE:match which was called 60 times, avg 3µs/call: # 60 times (201µs+0s) by Foswiki::Query::Node::newLeaf at line 127, avg 3µs/call
sub Foswiki::Query::Node::CORE:match; # opcode