Your approach seems good.  You can also do:

 (i.10) timex '+/i.10000'

Regarding the domain of timing code,

I'd be surprised, and so curious, if the standard deviation wasn't a "fixed 
percentage" of average time, with a bias for quickest functions having the 
highest standard dev as a percentage.  And also the timing on first iteration 
may be likely to be higher than remaining iterations.  Situations that deviate 
from these rules, might be a sign of something "wrong".






On Tuesday, January 11, 2022, 02:20:24 p.m. EST, Devon McCormick 
<[email protected]> wrote: 





Hi,

I sometimes time expressions with a left argument of something like 10 or
100, e.g. "(100) 6!:2 'singlePair testSP0'".  This gives me an average time
for the multiple iterations.  It would be nice to be able to get the
standard deviation of the multiple invocations as well.

I can do this myself with something like
  tms=. 6!:2 &>100$<'singlePair testSP0'
then doing statistics on "tms" but I'm wondering if there's a way to do
this more simply.
  tms=. 6!:2 &>100$<'singlePair testSP0'
  (mean,stddev) tms
0.260937 0.00313815

Thanks,

Devon
-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to