I can reproduce this bug. It seems j901 failed to recongize in-place
amend if the name M also appeared on the left
timespacex 'M =: (1+(;/I){M) (;/I) } M'
0.674831 5.36912e8
N=: M
timespacex 'M =: (1+(;/I){N) (;/I) } M'
7.5e_5 5.36912e8
N=: (15!:15) M
timespacex 'M =: (1+(;/I){N) (;/I) } M'
2.9e_5 41536
On Tue, Nov 12, 2019 at 3:17 PM Ben Gorte <[email protected]> wrote:
>
> Dear J'ers
>
> I'm using large 3D arrays (voxels), such as
> M =: ?400 400 400$100
>
> To add 1 to a bunch of voxels at positions
>
> I =: ?100 3$400
>
> I go like:
>
> timespacex 'M =: (1+(;/I){M) (;/I) } M'
>
> 1.3e_5 42048
>
> This was in version 8.07:
>
> JVERSION
>
> Engine: j807/j64/linux
>
> Release: commercial/2018-10-04T15:00:41
>
> Library: 8.07.26
>
>
> In version 9.01, however: timespacex 'M =: (1+(;/I){M) (;/I) } M'
>
> 0.238664 5.36912e8
>
>
> It became thousands of times slower! I'm doing this hundreds of thousands
> of times and it takes weeks instead of minutes.
>
>
> A multi-dimensional index for amend does not need to be boxed in j901, but:
>
> timespacex 'M =: (1+(;/I){M) I } M'
>
> 0.238302 5.36894e8
> gives pretty much the same result.
> This is with:
>
> JVERSION
>
> Engine: j901/j64avx2/linux
>
> Beta-p: commercial/2019-11-06T09:48:25
>
> Library: 9.01.10
>
> I was wondering whether it happend in { or }, but to my great surprise:
> timespacex 'new =: 1+(;/I) { M'
>
> 8e_6 21824
> timespacex 'M =: new (;/I) } M'
>
> 6e_6 20992
>
> So the solution is to do it in two steps !?!?
>
> With unboxed I in step 2, I get even:
>
> timespacex 'M =: new I } M'
>
> 2e_6 2560
>
>
> Am I missing a point? Could I have foreseen this?
>
> Greetings,
> Ben
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm