Help / Release / J 7.01 / f/ .g Improved

From J Wiki
Jump to navigation Jump to search


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



f/ .g Improved

initial writing: 2009-06-07
last updated: 2009-06-07


x f/ .g y is now faster and leaner on boolean x and y , atomic boolean functions g , and f being one of +. *. ~: . The following benchmarks illustrate the improvements. (+./ .*. and ~:/ .*. were previously improved in J5.04 and are only a little faster.)

ts=: 6!:2 , 7!:2@]  NB. time and space
x=: 1000 1000 ?@$ 2
y=: 1000 1000 ?@$ 2

ts 'x f/ .g y'
f/ .g  J 7.01    J 6.02    Ratio
~:/ .*. 0.147564 1.05203e6 0.194563 1.04992e6  1.32 1.00
+./ .*. 0.148855 1.05203e6 0.193751 1.04992e6  1.30 1.00
*./ .+. 0.148718 1.05203e6 1.768916 3.15360e6 11.89 3.00
*./ .=  0.297020 2.09850e6 1.689306 3.15360e6  5.69 1.50
+./ .~: 0.302557 2.09850e6 1.655030 3.15360e6  5.47 1.50
~:/ .=  0.298926 2.09850e6 1.663499 3.15360e6  5.56 1.50
+./ .>  0.148963 2.10061e6 1.672074 3.15360e6 11.22 1.50
*./ .<: 0.148627 1.05203e6 1.677359 3.15360e6 11.29 3.00
~:/ .+: 0.148872 2.10061e6 1.666052 3.15360e6 11.19 1.50




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