develooper Front page | perl.perl5.porters | Postings from August 2021

Re: Robin Hood Hashing for the perl core

Thread Previous | Thread Next
Tony Cook
August 20, 2021 06:15
Re: Robin Hood Hashing for the perl core
Message ID:
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'


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About