Hi Jean-Marc,
- The following code
declare function local:sequence($nb){for $i in 1 to xs:integer($nb) return $i}; prof:time(fn:count(local:sequence(1000000000000000000))) return 4.94 ms.
the InfoView will give you some hints what’s going on. The reason is that your code is compiled and simplified to the following query..
prof:time(fn:count((1 to 1000000000000000000)))
...which can then be evaluated in constant time.
- It seems that you somehow call the fn:trace function in the profile
module. Is there a way to catch the returned values of these functions?
Currently no. You can use the prof:current-ns() function instead:
let $start := prof:current-ns() let $void := prof:void((1 to 10000000)[. = 1]) let $end := prof:current-ns() let $ms := ($end - $start) div 1000000 return $ms || ' ms'
Hope this helps, Christian