If something's negligible, except for the times you have to think about it... it's not negligible.

I agree that parsing time is unimportant in most J programs - at least programs written by experienced J users.  JTRAN code (short sentences and atomic values) may spend a large fraction of the time in parsing.  I have tried hard not to leave beginners feeling the interpreter is too slow.

Consider two verbs:

   t1 =: 3 : 0
total =. 0
for. i. y do.
   total =. +&1 total
end.
total
)

   t2 =: 3 : 0
total =. 0
for. i. y do.
   total =. (+&1) total
end.
total
)

Spot the difference!  See it?  One set of parentheses.  Can that matter?

   10 (6!:2) 't1 1e6'
0.13314
   10 (6!:2) 't2 1e6'
0.0869105

Henry Rich



   6!:2 't 1e6'
0.0983993

On 9/29/2021 5:26 PM, Raul Miller wrote:
Parsing overhead being negligible or not depends on the associated
computational work.

If the computations are trivial, parsing overhead gains relative
significance. If the code is executed many times, that significance is
amplified. (Which is exactly what's happening in the example you've
shown here.)

But if the computations require significant time, or if they're only
used a few times, I think that parsing overhead would indeed be
negligible.

Anyways... pulling parsing out of inner loops and/or eliminating those
loops tends to be a Really Good Idea. (Which you know already. But
maybe it doesn't hurt too much to emphasize this.)

Thanks,



--
This email has been checked for viruses by AVG.
https://www.avg.com

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

Reply via email to