Changes

Jump to navigation Jump to search
716 bytes added ,  14:06, 21 February 2013
no edit summary
This [[Module Library|XQuery Module]] contains various testing, profiling and helper functions for XQuery code.
=Conventions=
| '''Summary'''
|Measures the time needed to evaluate {{Code|$expr}} and sends it to standard error or, if the GUI is used, to the Info View.<br />If {{Code|$cache}} is set to {{Code|true()}}, the result will be temporarily cached. This way, a potential iterative execution of the expression (which often yields different memory usage) is blocked.<br/>A third, optional argument {{Code|$label}} may be specified to tag the profiling result.
|-
| '''Properties'''
|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.
|-
| '''Examples'''
* {{Code|prof:time("1 to 100000")}} may output {{Code|25.69 ms}}.
* {{Code|prof:time("1 to 100000", true())}} may output {{Code|208.12 ms}}.
|-
| '''Properties'''
|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.
|}
| '''Summary'''
|Measures the memory allocated by evaluating {{Code|$expr}} and sends it to standard error or, if the GUI is used, to the Info View.<br />If {{Code|$cache}} is set to {{Code|true()}}, the result will be temporarily cached. This way, a potential iterative execution of the expression (which often yields different memory usage) is blocked.<br/>A third, optional argument {{Code|$label}} may be specified to tag the profiling result.
|-
| '''Properties'''
|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.
|-
| '''Examples'''
* {{Code|prof:mb("1 to 100000")}} may output {{Code|0 Bytes}}.
* {{Code|prof:mb("1 to 100000", true())}} may output {{Code|26.678 mb}}.
|-
| '''Properties'''
|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.
|}
| '''Properties'''
|In contrast to {{Code|fn:current-time()}}, the function is ''non-deterministic'', as it returns different values every time it is called. Its evaluation order will be preserved by the compiler.
|}
 
==prof:swallow==
 
{{Mark|Introduced with Version 7.6.1:}}
 
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|prof:swallow|$value as item()*|empty-sequence()}}
|-
| '''Summary'''
|Swallows all items of the specified {{Code|$value}} and returns an empty sequence. This function is helpful if some code needs to be evaluated and if the actual result is irrelevant.
|-
| '''Properties'''
|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.
|-
| '''Examples'''
|
* {{Code|prof:swallow(fetch:binary('http://my.rest.service'))}} performs an HTTP request and ignores the result.
|}
=Changelog=
 
;Version 7.6.1
 
* Added: <code>[[#prof:swallow|prof:swallow]]</code>
;Version 7.6
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu