Help / Release / J 6.01 / 2 f/\y Improved

From J Wiki
Jump to navigation Jump to search


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



2 f/\y

Improved

initial writing: 2005-06-08
last updated: 2005-06-09


2 f/\y is now implemented by special code for any verb f and any array y , removing the previous restrictions on f and y . The table below presents time and space comparisons; the bottom section of the table shows that 2 f/\x is more efficient in time and space than the equivalent (}:x) f (}.x) .


i=: 1e5 3 ?.@$ 10           integer
x=: o. i                    floating point
b=: 1e5 3 ?.@$ 2            boolean

ts=: 6!:2 , 7!:2@]          time and space
ts 'Expression'

Expression      J 6.01    J 5.04    Ratio
2 -:/\ i  0.00095811 1.325440e5 0.13497488 3.278720e6 140.88 24.74
2 -:/\ x  0.00365637 1.325440e5 0.14033382 5.375872e6  38.38 40.56
2 -:/\ b  0.00204922 6.568320e5 0.13355729 1.705792e6  65.17  2.60
2 -.@-:/\ i  0.00095596 1.328640e5 0.17538999 3.279104e6 183.47 24.68
2 -.@-:/\ x  0.00354134 1.328640e5 0.18362529 5.376256e6  51.85 40.46
2 -.@-:/\ b  0.00201308 6.571520e5 0.17742993 1.706176e6  88.14  2.60
 
(}: -:"_1 }.) i 0.00460509 4.326720e6 0.00476343 4.326720e6 
(}: -:"_1 }.) x 0.01125429 8.521024e6 0.01176834 8.521024e6 
(}: -:"_1 }.) b 0.00256332 1.180992e6 0.00249425 1.180992e6 




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