Thank you all for your comments.

Here is an illustration of the difference in performance between tacit and
explicit definitions, where there is minimal difference in the computations
demanded by each. Both calculate the mean along the last axis of an array
and both have infinite rank.

   tacit_mean=: (+/ % #)"1"_
   explicit_mean=: 3 :'(+/ % #)"1 y'

a is a large matrix

   a=: i.1000 1000

Watch each gobble it up, first as verbs with infinite rank:

   10 (6!:2) 'tacit_mean a'
0.0024503
   10 (6!:2) 'explicit_mean a'
0.0033749

The tacit one is a little quicker.

Now make each eat it up as rank 1 verbs:

   10 (6!:2) 'tacit_mean"1 a'
0.0047234
   10 (6!:2) 'explicit_mean"1 a'
0.0096502

The tacit verb is now twice as quick. As Roger has pointed out more than
once, factors of 2 in execution time are not very consequential, but it does
appear that tacit definitions do have performance benefits, and these are
more pronounced when the rank of the verb is less than the rank of its
argument.

Graham

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to