Set a flag on x. Check it at the same time you check whether the usecount is 1 to perform an in-place operation. If the operation is one of a few interesting ones (catenate, amend), look up the corresponding hash table and update it too. Otherwise discard the hash table.

(As for where to put the flag, perhaps steal a bit from the usecount?
 I'm sure no one will mind, seeing as there's not enough address space to
 saturate a full word's worth of usecount.)

 -E

On Wed, 2 Feb 2022, Henry Rich wrote:

That's a possibility, but how would you know when x changes, or is assigned to a different name?

Henry Rich

On 2/1/2022 8:27 PM, Elijah Stone wrote:
On Mon, 31 Jan 2022, Henry Rich wrote:

The deficiency in J is that m&i. gives you a hashtable for searching m, but if you modify m you have to recalculate the hash from scratch.  This makes m&i. a good read-mostly Dictionary but slow for frequent updates.

Why not cache the hash table for x when computing x i. y, and update it in-place when x is updated in-place?  That should provide ideal performance without requiring any changes to language semantics.

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

Reply via email to