Thanks Henry, I should have checked J903! I can confirm: J902 ==== 50 timespacex '8 +/@:% tstdata' 0.11405 1792 50 timespacex '8. +/@:% tstdata' 0.113427 1856
J903_beta-e =========== 50 timespacex '8 +/@:% tstdata' 0.00110812 4.19594e6 50 timespacex '8. +/@:% tstdata' 0.00112698 4.196e6 On Sun, Mar 14, 2021 at 2:34 PM Henry Rich <[email protected]> wrote: > (x f/@:g y) for atomic f and g has had special code for a long time. > The special code calculates (x g y) on each cell of g, and applies (f/) > on each cell as it is created. Thus (x g y) is never created in full. > > I revisited this for 9.03 beta-d. I found that the special code was > slower than the simple version in some cases: > > * less than 4 atoms per item of g > * less then 4 items of g > * g can be executed inplace > > and I turned the special code off in those cases. Now I get > > 50 timespacex '+/ 8 % tstdata' > 0.005984 4.19581e6 > 50 timespacex '8 +/@:% tstdata' > 0.00598417 4.19594e6 > > But I can offer you one improvement: > > 50 timespacex '8. +/@:% tstdata' > 0.0034118 4.196e6 > > Henry Rich > > > > > > > > On 3/13/2021 7:10 PM, Ric Sherlock wrote: > > I was initially surprised by the big differences in performance between > > different formulations of the sum of the quotients > > > > tstdata=: _2 */\ 1+2*i.1000000 > > > > 50 timespacex '+/ 8 % tstdata' > > > > 0.00206915 4.19581e6 > > > > 50 timespacex '8 +/@:% tstdata' > > > > 0.0686648 1792 > > > > The first is up to 113 times faster (depending on platform and J > version), > > the 2nd is over 2000 times leaner. I see similar differences back to > J602. > > I think this surprised me because I am usually comparing the sum of > > products. In that case I guess the special code for +/@:* hides the > "usual" > > difference > > > > 50 timespacex '+/ 8 * tstdata' > > > > 0.00193723 4.19581e6 > > > > 50 timespacex '8 +/@:* tstdata' > > > > 0.00042151 1664 > > > > > > It does make we wonder if we can't do better for quotient? I imagine the > > answer is yes but whether it is worth it depends on how often it is used. > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > -- > This email has been checked for viruses by AVG. > https://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
