What was I thinking? i. is much more prestigious than /:

   x=: ?1e8$65536
   y=: 0+x          NB. avoid selfie optimizations.  The effect is still 
present, but less pronounced
   x4=: 10 u:x
   y4=: 10 u:y
   x2=: 2 u:x4
   y2=: 2 u:y4
   timex'x i.y'
0.728156
   timex'x4 i.y4'
3.8804
   timex'x2 i.y2'
0.651964

Probably an oversight when 4-byte chars were added, on the theory that 2-byte chars would always get small-range optimization. (Which is, as a matter of fact, not the case.)

Attached is a patch fixing the problem. This also helps with 4-column matrices of 1-byte chars etc. (I think there may be reasonably cheap gains to be made across the board for i. on matrices of few columns, but at the very least small POT deserves to be fast.) This should also improve performance for smaller 2-byte arrays that do not make the small-range cut. With the patch:

   timex'x4 i.y4'
0.613455

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

Reply via email to