Thanks for the tip - it's a cleaner way to accomplish what I want.
I'm not sure about your standard deviation supposition or maybe I don't
understand what you're saying.
I think you can get arbitrarily large standard deviations by supplying
arguments with large standard deviations, e.g.
usus #&>vv=. (>:1000?1e4)?@$&.>0 NB.* usus: usual stats: min, max,
mean, SD
90 9991 5089.42 2783.04
tms0=. (100$1) 6!:2 '+/&>vv'
usus tms0
0.0016856 0.0034295 0.00185034 0.000233769
usus #&>vv=. (>:1000?1e6)?@$&.>0 NB. This input has similar mean%SD as
previous
2694 998076 507344 288719
tms1=. (100$1) 6!:2 '+/&>vv'
usus tms1
0.172931 0.21973 0.177071 0.0052448 NB. But mean%SD differs a lot between
the two sets of timings
%/_2{.usus tms0 NB. mean/SD
7.91526
%/_2{.usus tms1
33.7613
On Tue, Jan 11, 2022 at 2:56 PM 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> 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
>
--
Devon McCormick, CFA
Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm