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

Re: Robin Hood Hashing for the perl core

Thread Previous | Thread Next
August 26, 2021 16:36
Re: Robin Hood Hashing for the perl core
Message ID:
On Sun, 22 Aug 2021 at 05:40, Ed Avis <> wrote:

> Tony Cook wrote:
> >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.
> But that's equally true with the way hashing works currently.  The address
> changes, so the string representation changes, so you can no longer look up
> with the same key.
> % perl -Mthreads -le 'my $x = bless {}; $h{$x} = "hello"; print $h{$x};
> threads->create(sub { print $h{$x} // "undef" })->join'
> hello
> undef
> So while it's a reminder to be careful about object identity when you are
> using threads, it's not a point of difference between stringifying hash
> keys and hashing by address.

It is a demonstration that we dont have a well defined object identity
function and that having one would be useful. :-)


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