I don't like losing data to averages, so I have

    TimeToExecute=: verb define
      NB. The number of seconds to compute  x  executions of  y  (which must be 
quoted to delay execution).
      1 TimeToExecute y
      :
      (x $ 1) (6!:2) y
    )

and then I can run, for example

        10 TimeToExecute '0 1{"1 ] 100000 10 $ a'
    0.015575 0.015081 0.009818 0.01392 0.010023 0.009124 0.009203 0.008767 
0.008633 0.00938

and do various things with the results, including averaging them if that's what 
I need.

                        ... peter

On 09/12/13 14:28, Devon McCormick wrote:
This is one reason I like to look at time separately from space as 6!:2
takes an optional left argument to average the timing over multiple
repetitions, e.g.


    6!:2 '0 1{"1 ] 100000 10 $  a'
0.00741604
    6!:2 '0 1{"1 ] 100000 10 $  a'
0.00668613
    6!:2 '0 1{"1 ] 100000 10 $  a'
0.00724116
    6!:2 '0 1{"1 ] 100000 10 $  a'
0.00575015
    6!:2 '0 1{"1 ] 100000 10 $  a'
0.00510153

NB. Fairly high variance above vs. below:

    (10) 6!:2 '0 1{"1 ] 100000 10 $  a'
0.00504947
    (10) 6!:2 '0 1{"1 ] 100000 10 $  a'
0.004953
    (10) 6!:2 '0 1{"1 ] 100000 10 $  a'
0.0048413
    (10) 6!:2 '0 1{"1 ] 100000 10 $  a'
0.0046273
    (10) 6!:2 '0 1{"1 ] 100000 10 $  a'
0.00477414



On Thu, Sep 12, 2013 at 4:29 PM, Raul Miller <[email protected]> wrote:

I would note that several things can significantly influence timings.
It's also probably not wise to assuming that timing numbers are
completely reproducible.

    ts '0 1{"1 ] 100000 10 $  a'
0.005122 1.04882e7
    ts '0 1{"1 ] 100000 10 $  a'
0.00191 1.04882e7
    ts '0 1{"1 ] 100000 10 $  a'
0.00194 1.04882e7

Things that can influence timing include the version of the
interpreter, the make of the cpu and the amount of available memory
(compared to what's being used in the timing). Here, though, we're
only using 10MB for intermediate results, which is relatively small on
typical current computers.

Thanks,

--
Raul

On Thu, Sep 12, 2013 at 3:35 PM, Pascal Jasmin <[email protected]>
wrote:


An essay on boxed vs unboxed table data.
http://www.jsoftware.com/jwiki/PascalJasmin/Boxed%20vs%20unboxed%20data .

The results might surprise most of you since there's been signficant
performance tuning in J (around boxing) since its earlier days, and jmf and
3!:1 supports boxed data too now.

Let me know if I've made mistakes, or overlooked something big.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
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