sub micro second

  1. Why is \t not showing nano second level detail ? Anyway this can work ?

  2. I did the following :

0N!.z.N; h:hopen `:localhost:5001; 0N!.z.N

Result :

0D00:01:25.581071000

0D00:01:25.582701000

Difference :

001630000j nanoseconds

Question :

How can this be decreased within q itself ? Anything sub micro seconds ?

>nanoseconds


just getting the current time can take up to 2 microseconds:


q)1_“j”$deltas (.z.n;.z.n;.z.n;.z.n;.z.n;.z.n;.z.n;.z.n)

0 -1000 0 0 -1000 0 -2000


so even if the OS gave kdb+ the last three digits, they would just be noise due to the variation above.

so it wo

?variations of \t include

\t:n expr

\ts expr

\ts:n expr

where n is a positive integer indicating how many times to execute expr. Equivalent to

\ts do[n;expr]

useful for expr which do not have side-effects (and even then for some); can divide the resulting timing by n to get avg time.

The timing source for \t varies across platforms, and considering the jitter due to process scheduling/interrupts, it’s probably not meaningful to try to time a single run to nS precision.

?