Help / Release / J 5.03 / ~. Improved

From J Wiki
Jump to navigation Jump to search


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



~. Improved

initial writing: 2004-01-06
last updated: 2004-10-26


The monad ~. is now faster and leaner (as are other members of the i. family of facilities). The following benchmarks demonstrate the improvement.

b =: 1e6   ?@$ 2
b6=: 1e6 6 ?@$ 2
c =: a.{~ 1e6  ?@$ #a.
c2=: a.{~ 1e6 2?@$ #a.
c6=: a.{~ 1e6 6?@$ #a.
u =: u: 1e6 ?@$ 65536
i5=: 1e6 ?@$ 1e5
i6=: 1e6 ?@$ 1e6
i9=: 1e6 ?@$ 1e9
d =: 0.01*1e6 ?@$ 1e6
bx=: ":&.>?1e6$2e5

ts=: 6!:2 , 7!:2@]   NB. time and space
ts 'Expression'
Expression  J 5.03  J 5.02  Ratio
~.b  Boolean list  0.030883   7.680000e2 0.104236   9.437888e6 3.38 12288.92
~.b6 Boolean table 0.258281   1.677792e7 0.367496   1.258362e7 1.42 0.75
~.c  literal list  0.031164   1.664000e3 0.102883   9.438336e6 3.30 5672.08
~.c2 literal table 0.037219   3.938560e5 0.185982   9.699968e6 5.00 24.63
~.c6 literal table 0.606159   1.677792e7 0.737786   1.782643e7 1.22 1.06
~.u  Unicode  0.037584   3.938560e5 0.164569   9.699968e6 4.38 24.63
~.i5 integer list  0.084340   6.560000e5 0.286684   1.258355e7 3.40 19.18
~.i6 integer list  0.178966   5.243520e6 0.404330   1.363213e7 2.26 2.60
~.i9 integer list  0.480677   1.258355e7 0.564432   1.363213e7 1.17 1.08
~.d  float list  1.351204   1.677786e7 1.454014   1.782643e7 1.08 1.06
~.bx boxed list  3.737520   1.258355e7 3.688013   1.258355e7 0.99 1.00



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