a. The analysis can be hairier than described in your msg. If it weren't, it would not have taken until J6.01 to implement the improvement described in "Box Array References Improved" http://www.jsoftware.com/books/help/release/bxref.htm .
b. Even when knowing that an array can be modified in place, changes in multiple places in the interpreter are required to exploit the fact, with the number of places at least as numerous as the number of primitive verbs. c. I am not sure that the time benefits would be commensurate with the amount of work. ----- Original Message ----- From: "Henry Rich" <[EMAIL PROTECTED]> To: "'Programming forum'" <[email protected]> Sent: Wednesday, April 26, 2006 12:29 PM Subject: [Jprogramming] Can verbs in trains be applied in place? I may be stupid, but I'm going to suggest an interpreter improvement (In WWII Admiral King replied to a similarly- opened message of Kelly Turner's with a curt "delete all after stupid."). In a train like (1 (0)} 0 = ]) the verb (0)} is not applied in-place. It looks to me that it should be possible to make it in-place, and that much could be saved it it were. The advantage of in-place execution is obvious in the verb (0}) , but I expect it will be worth the analysis time for all verbs, because 0. reusing a memory area makes for more efficient use of cache, since one operand's worth of cache resources are left untouched. 1. the main-memory stores for the result should be reduced, since the stores to cache will always be hits in the cache rather than requiring cast-outs of existing cache lines. (some poring over processor specs may be called for to verify these claims, and I would be willing to do that on request) If each data block has a use count, the result of V0 and V2 in (V0 V1 V2) should have a use count of 1, which would signal them as candidates for in-place execution. I am assuming that in something like V0 name the data block for 'name' has a use count of 2, one for the stored value and one for its use as an operand to V0. Similarly, in (V0 V1 V2) V3 name the result of V3 has a use count of 1, but that is incremented when (V0 V1 V2) is executed, so that in-place operation would be possible on V0 but not V2. The reason for making name =: op name not in-place has been that recovery from error is a problem, but I don't see how that applies to the intermediate results of long verb phrases. Henry Rich ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
