I'm with Raul on this.  A hashtable is a fine idea when memory is fast, but if the hashtable greatly exceeds D3$ every hash lookup will be a page miss which is hideous.  A merge sort would look pretty good then.

Henry Rich

On 4/9/2022 3:23 PM, Elijah Stone wrote:
If ~.!.1 is used, then how would we denote a -. operating on sorted arguments?

I build the hash table concurrently, using a multiprocessor; this means the elements are processed out of order.  Two ways of proceeding, not yet sure which is better.  The first is for each thread to accumulate the unique values it finds to a temporary buffer; once the hash table is completely built, the threads negotiate and then copy their buffers into the result.  The second is to logically divide the hash table into fixed-size chunks of buckets, and to track, for each chunk, how many of its buckets are occupied; once the hash table is completely built, associate each chunk of the hash table with a (non fixed-size) section of the result, and copy the elements out.

The former method does work concurrently with building the hash table, which alleviates contention, but the latter method uses less space.

On Sat, 9 Apr 2022, Henry Rich wrote:

I would favor ~.!.1.  No mnemonic value, but less likely to be forgotten.

What is your fast algorithm?

Henry Rich

On 4/9/2022 4:03 AM, Elijah Stone wrote:
Suppose that ~. (and perhaps some relatives) can be implemented much more efficiently if no guarantee is made about the order of the result.  Is it too much of an abuse of notation to use ({~?~@#)@~. as a special combination to invoke such an algorithm?  If so, what would be better?

Most special combinations would not incur a performance penalty vs an alternate expression of the same semantics on an implementation which did not recognise special combinations. But I cannot think of any way of expressing ambivalence regarding the order of a result other than shuffling it.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
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

----------------------------------------------------------------------
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