Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

implementation of perl hashes, what type of hashing system is used

by baxy77bax (Chaplain)
on Sep 16, 2009 at 11:35 UTC ( #795573=perlquestion: print w/replies, xml ) Need Help??
baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:

hi,

i have a bit technical question. hashing in Perl is a very practical tool, but now i'm interested to learn a bit more about it. what type of hashing stands behind the hash 'function', is it a "General Hash Function Algorithms 0.0.1" or...

where can i learn more about Perl hashing (and i don't mean how to hash some data but rather what happens when i hash a string of characters, integer... , what is the complexity of retrieving hash data and so on...).

thank you

baxy

Update: ok thank you when i study recommended references i'll come back with more questions

thank you

  • Comment on implementation of perl hashes, what type of hashing system is used

Replies are listed 'Best First'.
Re: hash function what type of hashing system is used
by dHarry (Abbot) on Sep 16, 2009 at 12:10 UTC

    Some pointers: I found How Hashes Really Work very useful. The article also contains some interesting links like this article by Bob Jenkins (A must read IMHO). If you really want to know the gory details you can dig into the C-code (see for example hv.c).

    enjoy;)

Re: hash function what type of hashing system is used
by almut (Canon) on Sep 16, 2009 at 12:03 UTC

    In case you want to learn more about what Perl is exactly doing when accessing hashes, the source code would be one place to start (in particular hv.c).

    If you're more interested in a general discussion, you could try Bob Jenkins' site — there are some interesting reads to be found, e.g. Hash Functions for Hash Table Lookup   (probably best to start with the latter, and then dig into the code once you have a clearer idea of what you're looking for).

Re: hash function what type of hashing system is used
by ikegami (Pope) on Sep 16, 2009 at 12:53 UTC

    where can i learn more about Perl hashing (and i don't mean how to hash some data [...])

    Then don't use the term "hashing". You want to learn more about the implementation of Perl hashes, not "Perl hashing". The simple answer is that they're an implementation of a hash table. More in-depth answers have already been given.

    what is the complexity of retrieving hash data

    The average complexity for fetching, inserting and deleting is O(1).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://795573]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
[ambrus]: marto: no, not that way. if you just want to test for an existing id attribute, then write *[@id] , or you can match a regexp to the value of that attribute like *[@id=~/something/ ]
[marto]: ambrus, thanks I ended up going with '//*[starts- with(@id, "thread_")]...
[ambrus]: Sometimes it's easier to just match elements in ways other than xpath, like directly with perl code.
[marto]: this is a cheap hack, a script that doesn't need to run for long, using WWW::Mechanize:: Firefox to drive some awful interface.
[marto]: if it were anything more serious I'd spend more time looking into it properly :P

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2016-12-08 10:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (140 votes). Check out past polls.