Help / Release / J 6.01 / i. Improved

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



i.

Improved

initial writing: 2005-06-27
last updated: 2005-07-04


The i. family of primitives (dyads: i. i: e. -. u/. ; monads: ~. ~: = ) has been made faster when:

  • x and y are boxed; and
  • x has singleton items ( y having singleton items in the case of e. ); and
  • opened atoms of x and y have the same type, and that type is not floating-point, complex, or boxed.

(For monads the requirements apply to y alone.) The case where that same type is literal was

already fast and the improvement is not as great.

The following benchmarks demonstrate the improvement:

i1=: (1e4 ?@$ 100) ?@#&.> 100
c1=: ":&.> i1

i2=: (2e4 ?@$ 100) ?@#&.> 100
c2=: ":&.> i2

ts=: 6!:2 , 7!:2@]
ts 'Expression'
Expression      J 6.01    J 5.04    Ratio
i.~ i1 0.00974926 197376 0.20099158 197376 20.62 1.00
~.  i1 0.01110098 197248 0.20011495 197248 18.03 1.00
i.~ i2 0.02010718 393984 1.76146159 393984 87.60 1.00
~.  i2 0.02360515 393856 1.76543031 393856 74.79 1.00
i.~ c1 0.00831639 197376 0.01766063 197376  2.12 1.00
~.  c1 0.01000640 197248 0.01936748 197248  1.94 1.00
i.~ c2 0.01687797 393984 0.03606743 393984  2.14 1.00
~.  c2 0.02073817 393856 0.04019880 393856  1.94 1.00




>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release