---Viktor Cerovski wrote:
> I'm not that excited about going from @ to @: by default
> (except of course
> in this case :-), since these are two different operations
> each with its own
> properties.  As far as the speed is concerned, [EMAIL PROTECTED]@h suggests 
> using a
> pipeline kind of processing, thus being (only) in principle
> faster than
> f@:g@:h which processes the same array over and over (at
> least that's how I
> would implement it, although a pipeline evaluation is also possible).
> In practice, the latter is faster probably because of efficient
> vectorizations
> of each individual f, g and h, while, in contradistinction,
> evaluation of
> [EMAIL PROTECTED]@h
> for each element of the argument probably requires some
> overhead work of
> the interpreter.
>
> Furthermore, it seems to me that plenty of verb applications are
> implemented implicitly as @:, so that should also help keep
> things fast
> without bothering with converting things explicitly into @: versions.

I agree that in many cases (eg. where v has rank _) using @: is not necessary. 
I think Henry's point is that if you're not sure of (or can't be bothered ;-)) 
checking the appropriate verb ranks, then it is safer (from a performance point 
of view) to use @: rather than @ .
>From JfC:
"The actual cell-at-a-time execution of [EMAIL PROTECTED] is different in two 
ways: it is slower because the verb v must be restarted for each cell; and if 
the temporary space required by u or v is large, cell-at-a-time execution uses 
less space because the temporary space for each cell is freed before the next 
cell is processed."

At times they will also give different results- from JfC
   1 2 3 +/@:* 1 2 3
14
   1 2 3 +/@* 1 2 3
1 4 9
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to