Help / Release / J 4.06 / { Improved

From J Wiki
Jump to navigation Jump to search


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



{

Improved

initial writing: 2000-10-20
last updated: 2004-10-26


The case (<i;j;k; ...){y where leading indices are singleton integer arrays, is now implemented by special code. Some benchmarks:

   ts=: 6!:2 , 7!:2@]  NB. time and space

   a=: ?. 2 3 4 1e5$1e9   [ i=: <(?.&.>2 3 4),<?.4 5$1e5
   b=: o.?.40 2 15000$1e6 [ j=: <20;0;_4
   c=: ?. s$1e9           [ k=: <?.&.>$s=:13 11 7 5 3 2
Expr.     J 4.06       J 4.05      
i{a 2.54222e_5   1408     1.12953e_2 2098560
j{b 2.29079e_5 1088 7.09867e_4   132352
k{c 1.88292e_4 17216 6.64889e_5 17408


Also, the dyad { for Boolean left arguments is now implemented by special code. Some benchmarks:

   b=: ?.1e6$2
   x=: (2,c)$'abcdefghijqrstuvwxyz'
   ts 'b{x'
c J 4.06 J 4.05 Time
Ratio
1 0.0217949 1.049280e6 0.1060300 9.438080e6 4.86
2 0.0227065 2.097856e6 0.1074530 1.048666e7 4.73
3 0.0390362 4.195008e6 0.1726359 1.258381e7 4.42
4 0.0283271 4.195008e6 0.1164168 1.258381e7 4.11
5 0.0456212 8.389824e6 0.1772309 1.677811e7 3.88
6 0.0446817 8.389824e6 0.1964577 1.677811e7 4.40
7 0.0478795 8.389824e6 0.2010920 1.677811e7 4.20
8 0.0426456 8.389312e6 0.1538154 1.677811e7 3.61
9 0.0574534 1.677794e7 0.2152081 2.516672e7 3.75
10 0.0579359 1.677794e7 0.2198388 2.516672e7 3.79
11 0.0729431 1.677794e7 0.2220768 2.516672e7 3.04
12 0.0833206 1.677794e7 0.2088402 2.516672e7 2.51
30  0.1592722 3.355718e7  0.2551766 4.194394e7  1.60




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