On Wed, Aug 18, 2021 at 01:09:47PM +0000, Ed Avis wrote: > But I think it must also be slower. Surely if you have the reference you can treat it as an address (a 64-bit or 32-bit integer) and have a fast way to transform that to a position in the hash data structure. Even if the "address hashing" function ends up being fairly complex, it still has to be faster than converting the address to ASCII text and then hashing the string. Storing the string will also use more memory than storing a pointer plus a tag to say what type of object. In addition to Nicholas's response, when objects are duplicated into a new thread the duplicated object has a new address which breaks the hash, and finding the object given the address. $ perl -Mthreads -le 'my $x = bless {}; print $x; threads->create(sub { print $x })->join; print $x' main=HASH(0x55ddc8938278) main=HASH(0x55ddc8a7b1c0) main=HASH(0x55ddc8938278) TonyThread Previous | Thread Next