All i did was delete the loop construct lines for both while/for so that
the code runs straight thru one time for the non-loop version.  Then I did

1000 (6!:2) 'f tlpmcmc 1e1'

for both loop/non-loop versions to get the average elapsed time figures
reported above.

For non-loop version the passed in arg '1e1' is not used, otherwise the
while section loops 1e1 times.  Inside the while loop are four 'for' loops
in sequence; the first/third  are  two nested 'for' loops 5x3 for a ttl of
15  the second/fourth are 3x1=3 for a ttl of 15 yielding  a grand total
of 36 for loops for each while loop.  The code is attached.  'tlpmcmcx.j'
is the loop code,  'tlpmcmcxx.j' is the loop-less.  Regrettably this
examination revealed an asymmetry between the two version as I had
incorrectly modified an 'if' statement (now removed) to yield these updated
numbers:

   J        No loops        |     Loops.          |     Ratio
-----------------------------|---------------------|-------
805:       0.00179901  |   0.01162814    |   6.46
806:       0.0018808    |   0.02488977    |   13.23
-----------------------------|---------------------|-------
Ratio:       1.05            |       2.14            |   2.05


Slightly, but mostly immaterially different.  I am now wondering about what
the cumulative effect of 5% elapsed time expansion in loop-less trial
between J versions means for the looping trial .





On Fri, Apr 21, 2017 at 11:29 AM, Xiao-Yong Jin <[email protected]>
wrote:

> Can you give an example as how you changed the loops to no-loops?
> I'm just curious.
>
> > On Apr 21, 2017, at 11:04 AM, [email protected] wrote:
> >
> > Henry - regarding the neural network code I posted in wierdness #2,
> some quick and dirty timing tests:
> >
> >             No loops.     Loops.      Ratio
> > 805:       0.00181       0.01067     5.9
> > 806:       0.00191       0.025         13
> > Ratio:         1.06            2.34.        2.21
> >
> > Loops means 10 'while' loops within which are about 20 'for' loops.
> Incredibly it seems that the presence of the loop control constructs is
> responsible for the performance degradation.
> >
> >
> >
> > Sent from my iPad
> >
> >> On Apr 20, 2017, at 20:19, Henry Rich <[email protected]> wrote:
> >>
> >> name =: verb define
> >> smoutput 'time at point 1: ' , ": 6!:1''
> >> NB. do something
> >> smoutput 'time at point 2: ' , ": 6!:1''
> >> NB. etc.
> >> )
> >>
> >> untested
> >>
> >> Henry Rich
> >>
> >>
> >>
> >>
> >>> On 4/20/2017 8:15 PM, Michael Goodrich wrote:
> >>> Henry
> >>>
> >>> You could save me some time if you could post a code example
> >>> ----------------------------------------------------------------------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >>
> >> ---
> >> This email has been checked for viruses by AVG.
> >> http://www.avg.com
> >>
> >> ----------------------------------------------------------------------
> >> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to