Changes

Jump to navigation Jump to search
1,909 bytes added ,  17:29, 23 November 2017
no edit summary
==prof:time==
 
{{Mark|Updated with Version 9.0:}} {{Code|$cache}} argument removed.
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:time|$expr as item()|item()*}}<br />{{Func|prof:time|$expr as item(), $cache as xs:boolean|item()*}}<br />{{Func|prof:time|$expr as item(), $cache as xs:boolean, $label as xs:string|item()*}}
|-
| '''Summary'''
|Measures the time needed to evaluate {{Code|$expr}} and sends it outputs a string to standard error or, if the GUI is used, to the Info View.<br />If An optional {{Code|$cachelabel}} is set may be specified to {{Code|true()}}, tag the profiling result . Helpful notes:* Profiling might change the behavior of your code: An expression that might be executed iteratively will be temporarily cachedby the profiling function. This way* If a value has a compact internal representation, a potential iterative execution of the expression (which often yields different memory usage) is blocked.<br/>A thirdevaluation time will be very low, optional argument {{Code|$label}} even if it may be specified take a long time to tag the profiling resultiterate through all results.
|-
| '''Properties'''
| '''Examples'''
|
* {{Code|prof:time("1 to 100000")}} may output {{Code|25.69 ms}}.* {{Code|prof:time("1 to 100000", truesleep(1000))}} may output outputs something similar to {{Code|2081000.12 99 ms}}.
|}
==prof:memmemory== {{Mark|Updated with Version 9.0:}} Renamed (old name: <code>prof:mem</code>); {{Code|$cache}} argument removed.
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:memmemory|$expr as item()|item()*}}<br />{{Func|prof:memmemory|$expr as item(), $cache as xs:boolean|item()*}}<br />{{Func|prof:mem|$expr as item(), $cache as xs:boolean, $label as xs:string|item()*}}
|-
| '''Summary'''
|Measures the memory allocated by evaluating {{Code|$expr}} and sends it outputs a string to standard error or, if the GUI is used, to the Info View.<br />If An optional {{Code|$cachelabel}} is set may be specified to {{Code|true()}}, tag the profiling result . Helpful notes:* Profiling might change the behavior of your code: An expression that might be executed iteratively will be temporarily cachedby the profiling function. This way* If a value has a compact internal representation, a potential iterative execution of memory consumption will be very low, even if the expression (which often yields different serialized result may consume much more memory usage) is blocked.<br/>A third* In Java, optional argument {{Code|$label}} may memory profiling can only be specified to tag approximative: To improve the profiling resultmeasurement, main-memory will be garbage-collected before and after evaluation.
|-
| '''Properties'''
| '''Examples'''
|
* {{Code|prof:memmemory(("1 to 100000") ! <a/>)}} may will output something similar to {{Code|5620 kB}}.|} ==prof:track== {{Mark|Introduced with Version 9.0 Bytes:}}. {| width='100%'|-| width='120' | '''Signatures'''|{{Func|prof:track|$expr as item()|item()* }}<br/>{{CodeFunc|prof:memtrack|$expr as item("1 to 100000"), true$options as map(*)|item()*}} may output |-| '''Summary'''|Measures the execution time and memory consumption required for evaluating the specified {{Code|$expression}} and returns a map with the results. The following {{Code|$options}} are available:* {{Code|memory}}: Enables time profiling (default: true).* {{Code|26time}}: Enables memory profiling (default: true).678 mb* {{Code|value}}: Returns the value (default: true).Helpful notes:* Profiling might change the behavior of your code: An expression that might be executed iteratively will be cached by the profiling function.* If a value has a compact internal representation, memory consumption will be very low, even if the serialized result may consume much more memory.* In Java, memory profiling can only be approximative: To improve the measurement, and if the memory option is enabled, main-memory will be garbage-collected before and after evaluation. If you are not interested in the memory consumption, it is advisable to disable this option.|-| '''Properties'''|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.|-| '''Examples'''|The function call <code>prof:track((1 to 1000000)[. mod 2 = 0])</code> will return something similar to:<pre class="brush:xquery">map { "memory": 41548400, "time": 34.99, "value": (2, 4, 6, 8, 10, ...)}</pre>
|}
=Changelog=
 
;Version 9.0
 
* Added: [[#prof:track|prof:track]]
* Updated: renamed prof:mem to [[#prof:memory|prof:memory]]
;Version 8.5
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu