Christian,

thx for your answers.
the InfoView will give you some hints what’s going on
oh...I should have thought about it. I still don't have this reflex. thanx

>Currently no. You can use the prof:current-ns() 
I thought about this one, but isn't this method less accurate than prof:time ? 


 


2013/12/4 Christian Grün <christian.gruen@gmail.com>
Hi Jean-Marc,

> 1) 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.


> 2) 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