Interesting note Dan about the space occupied by a boxed noun containing multiple identical references.

I would have thought the following would only show a marginal increase in space from z to zz (as zz contains 5 references to z):

       z=:<i.100 100
       7!:5<'z'
    65600
       zz=:5$z
       7!:5<'zz'
    327744

This reports 5 x the space, but I would have expected (1 x space of z + 5 x references to z).

Roger, could this discrepancy be in the calculation of space used by 7!:5 when a boxed noun includes an array of the same references ?

.../Rob Hodgkinson

On 16/09/2008, at 4:02 AM, Dan Bron wrote:
...

Still, I'm surprised by your second observation, as I thought that the expression x $ < y was optimized by creating an array of pointers to the same box, rather than copying the actually data. As in:

           z=.i. 1000 1000
           7!:5<'z'
        4.1943e6
        
           Z=.1 $ z
           7!:5<'Z'
        4096
        
           Z=.4 $ z
           7!:5<'Z'
        16384
        
           Z=.4 4 4 $ z
           7!:5<'Z'
        262144
        
-Dan



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

Reply via email to