See https://code.jsoftware.com/wiki/Vocabulary/IFamily#Performance .

Tolerant i.-family operations on arrays are tough.  They end up doing sequential search.  ~.!.0 will be much faster, if you don't need the tolerance.

Henry Rich

On 8/29/2023 8:47 PM, Ben Gorte wrote:
Dear J,

I noticed that ~. (nub) can become very slow on float arrays - is that
known?
Mine was a 9 million times 6 array and it seemed to hang on my laptop.
This can be demonstrated as:

idx =: 4$.$.10 10 10 10 10 10$1 NB. a million different tuples of 6 integers

6!:2 'echo $ ~. idx'

1000000 6

0.068726

fdx =. 0.0+idx NB. now with floats:

6!:2 'echo $ ~. fdx'

1000000 6

225.568

JVERSION

Engine: j9.4.1/j64/linux

Build: commercial/2023-02-27T15:21:43/clang-11-0-0/SLEEF=1

Library: 9.4.21

Qt IDE: 2.0.3/5.12.8(5.15.3)

Platform: Linux 64

Installer: j9.4 install

InstallPath: /home/ben/j9.4

Contact: www.jsoftware.com

I haven't tried other J versions, except the (current) playground in
Firefox. There it is similar.


Other than that I am continuing to enjoy J, daily.


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

Reply via email to