Help / Release / J 5.03 / u/. Improved
< Help
Jump to navigation
Jump to search
>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release
u/. Improved |
initial writing: 2003-09-03 |
The key adverb u/. has been made more efficient for the following cases:
- The dyad x #/. y
- The cases x </.i.#x and (</. i.@#) x (group the indices of identical items of x)
- The dyad x f//. y where y is a vector,
and f and y are one of the following combinations:
verb f y type = <. >. + +. * *. ~: Boolean <. >. + integer, floating-point n b. for n= 17 22 23 25 integer (In J 6.02 the restriction that y be a vector is removed.)
The following benchmarks demonstrate the improvements in time and space.
x1=: ?1e6$10 x2=: ?1e6$100 x3=: ?1e6$1000 x4=: ?1e6$10000 c=: (?1e6$10000){a.{~?1e4 6$#a. b=: ?1e6$2 i=: ?1e6$1000 d=: 0.01*?1e6$1e6 ts=: 6!:2 , 7!:2@] ts 'Expression'
Expression | J 5.03 | J 5.02 | Ratio | ||||||
x1 #/. i | 0.054980 | 1088 | 0.142855 | 1.258374e7 | 2.60 | 11565.94 | |||
x2 #/. i | 0.061149 | 1856 | 0.148341 | 1.258374e7 | 2.43 | 6780.03 | |||
x3 #/. i | 0.057310 | 9024 | 0.151128 | 1.258374e7 | 2.64 | 1394.48 | |||
x4 #/. i | 0.058312 | 131904 | 0.163465 | 1.258374e7 | 2.80 | 95.40 | |||
c #/. i | 0.466662 | 12583808 | 0.523424 | 1.258381e7 | 1.12 | 1.00 | |||
x1 </.i.#x1 | 0.146615 | 9.438592e6 | 0.541370 | 3.565293e7 | 3.69 | 3.78 | |||
x2 </.i.#x2 | 0.161843 | 1.075046e7 | 0.571060 | 3.696403e7 | 3.53 | 3.44 | |||
x3 </.i.#x3 | 0.173669 | 9.655296e6 | 0.603863 | 3.588218e7 | 3.48 | 3.72 | |||
x4 </.i.#x4 | 0.246410 | 9.731584e6 | 0.709207 | 3.582688e7 | 2.88 | 3.68 | |||
c </.i.#c | 0.738528 | 1.799411e7 | 1.094735 | 3.580832e7 | 1.48 | 1.99 | |||
(</. i.@#) x1 | 0.110250 | 5.244480e6 | 0.543262 | 3.565312e7 | 4.93 | 6.80 | |||
(</. i.@#) x2 | 0.117883 | 6.556352e6 | 0.571406 | 3.696422e7 | 4.85 | 5.64 | |||
(</. i.@#) x3 | 0.130114 | 5.461184e6 | 0.605503 | 3.588237e7 | 4.65 | 6.57 | |||
(</. i.@#) x4 | 0.203980 | 5.537472e6 | 0.716786 | 3.582707e7 | 3.51 | 6.47 | |||
(</. i.@#) c | 0.651008 | 1.380013e7 | 1.101898 | 3.580864e7 | 1.69 | 2.59 | |||
x1 +//. i | 0.089229 | 1472 | 0.489221 | 3.145965e7 | 5.48 | 21372.04 | |||
x2 +//. i | 0.091571 | 2240 | 0.545150 | 3.277690e7 | 5.95 | 14632.54 | |||
x3 +//. i | 0.089238 | 9408 | 0.580384 | 3.169478e7 | 6.50 | 3368.92 | |||
x4 +//. i | 0.093303 | 132288 | 0.696549 | 3.237165e7 | 7.47 | 244.71 | |||
x1 +//. b | 0.061756 | 1472 | 0.422279 | 2.438176e7 | 6.84 | 16563.70 | |||
x2 +//. b | 0.061645 | 2240 | 0.494004 | 2.471597e7 | 8.01 | 11033.91 | |||
x3 +//. b | 0.061742 | 9408 | 0.510600 | 2.489747e7 | 8.27 | 2646.41 | |||
x4 +//. b | 0.065804 | 132288 | 0.639285 | 2.635066e7 | 9.71 | 199.19 | |||
x1 +.//. b | 0.057070 | 1344 | 0.422874 | 2.438170e7 | 7.41 | 18141.14 | |||
x2 +.//. b | 0.057171 | 1728 | 0.493326 | 2.471571e7 | 8.63 | 14303.07 | |||
x3 +.//. b | 0.057439 | 5312 | 0.516077 | 2.489747e7 | 8.98 | 4687.02 | |||
x4 +.//. b | 0.061470 | 33984 | 0.650361 | 2.630214e7 | 10.58 | 773.96 | |||
x1 23 b.//. i | 0.088951 | 1856 | 0.514752 | 3.145997e7 | 5.79 | 16950.41 | |||
x2 23 b.//. i | 0.088652 | 2816 | 0.541060 | 3.277722e7 | 6.10 | 11639.64 | |||
x3 23 b.//. i | 0.091216 | 11776 | 0.580654 | 3.173197e7 | 6.37 | 2694.63 | |||
x4 23 b.//. i | 0.092286 | 148992 | 0.696234 | 3.237453e7 | 7.54 | 217.29 | |||
x4 +//. d | 0.099751 | 279744 | 0.740266 | 4.168851e7 | 7.42 | 149.02 | |||
c +//. d | 0.536441 | 12584192 | 1.096851 | 4.167213e7 | 2.04 | 3.31 |