Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Potential hash key ids limitations

by LanX (Saint)
on Jan 19, 2023 at 04:01 UTC ( [id://11149680]=note: print w/replies, xml ) Need Help??


in reply to Potential hash key ids limitations

Short answer: any kind of string and string length can be a key. °

> (length-wise I mean).

Of course you can hit the memory limits and trigger the OS to do page swapping to the hard disc, which will slow down things considerably.

But that's always the case for big data and not particular to the key's length.

So yes, key lengths in the order of GBs will expose limitations, but so will simple strings too.

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

°) IIRC: the way keys are internally stored is actually a bit complicated in order to make it memory efficient. If you reuse a very long key in multiple hashes, you'll notice that the corresponding string is only stored once globally and all equivalent hash-keys will point to that string.

Replies are listed 'Best First'.
Re^2: Potential hash key ids limitations
by cavac (Parson) on Jan 19, 2023 at 16:07 UTC

    In case of hash keys in the GB range, i would also avoid anything like

    foreach my $key (sort keys %myhash) {

    But yeah, otherwise Perl just doesn't care what you put in hash keys (or any other kind of scalars). Last time i had to find duplicate thumbnails, i just used the png files as keys. You can't go much more "random binary junk" then compressed image data...

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149680]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-24 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found