It's hard to know what typical is. Selection is pretty common, as are
reshape, take, and drop, and they can operate on data without moving
it. Perhaps the most common operations are arithmetic, and they can be
performed in place much of the time. Many operations, like u;.1, u/,
u"n, can operate on data without moving it. u;._3 goes to great lengths
to avoid copying the input.
The size of an array is 56 bytes + 8 bytes per axis + the data, all
rounded up to a power of 2.
Henry Rich
On 3/4/2020 2:26 PM, Raul Miller wrote:
Hmmm...
We're working with rank 1 lists here, so 40 bytes overhead for each array.
Also, I think we should assume a 64 bit J implementation, so another 8
bytes for each value in these arrays.
So... 'a' would be 800040 bytes and 'b' would be 80 bytes.
Anyways... the expression b { 9999999 ,~ ] a looks like it'll build a
modified copy of a for another 800048 bytes and then build its result
for another 80 bytes. Hypothetically speaking, that 800048 byte
intermediate result could be avoided, and I guess this is a relatively
common pattern for people wanting to avoid index errors.
That said, testing, on j901, I see timespacex reporting 1536 bytes
consumed in the intermediate result. So I guess that means you've
implemented support for this pattern. Sounds good to me.
On the other hand, the operations in this example are much simpler
than typical cases for u in u^:n, aren't they?
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