| f@]^:g Improved |
initial writing: 2005-07-14 last updated: 2005-07-18 |
The following phrases are equivalent:
| x f@]^:g y | ||
| x f@]^:(x g y) y | definition of u^:v | |
| x&(f@])^:(x g y) y | definition of x u^:n y | |
| f^:(x g y) y | definition of & and @ and ] |
Evaluation of the first phrase has been made more efficient by implementing it as the last phrase, applying f instead of x&(f@]) on each iteration. The amount of improvement depends on the verb f : up to a factor of 1.5 for very simple f , and hardly measureable for complex f . The following benchmarks demonstrate the improvement:
| Expression | J 6.01 | J 5.04 | Ratio | |||||||||
| 1e5 >:@]^:[ 1 | 0.0335399 | 1408 | 0.0503185 | 1536 | 1.50 | 1.09 | ||||||
| 15 +/ .*~@]^:[ 0 1,:1 1x | 0.0524145 | 126784 | 0.0524282 | 126912 | 1.00 | 1.00 | ||||||