in reply to PerlApi: hashes
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PerlApi: hashes
by Anonymous Monk on Aug 12, 2015 at 02:38 UTC | |
http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=grep&s=HeHASH | [reply] |
by BrowserUk (Patriarch) on Aug 12, 2015 at 04:32 UTC | |
HeHASH Returns the computed hash stored in the hash entry. U32 HeHASH(HE* he) Which is fine ... Er, actually, it is terminally stupid. In order to obtain the HE* for a key, I first need to look it up; and in order to lookup the key, I need to calculate the hash value! Reminds me of the old joke: Anti-thirst pills; take two in a glass of water. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
| [reply] |
|
Re^2: PerlApi: hashes
by BrowserUk (Patriarch) on Aug 12, 2015 at 04:28 UTC | |
hv_exists_ent() But if I supply the hash value, why does it need the keysv? If all I have is the string and its length (the normal case), it means I have to construct an SvPV which is surely more computationally and time costly than simply recalculating the hash; as it requires a several memory allocations.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
| [reply] |
by Anonymous Monk on Aug 12, 2015 at 06:40 UTC | |
Seems all the hash functions are built on http://perldoc.perl.org/perlapi.html#hv_common which is undocumented and subject to change, at least its Only 579 lines http://perl5.git.perl.org/perl.git/blob?f=hv.c#l337 http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=grep&s=PERL_HASH_WITH_SEED | [reply] [d/l] |
by BrowserUk (Patriarch) on Aug 12, 2015 at 12:38 UTC | |
hello? https://metacpan.org/pod/Hash::Util#hash_value Nice find! But, it doesn't help :( I can use the PERL_HASH macro to obtain the hash value; but even if I set up an SV with the key for hv_exists_ent() to ignore; it complains: Use of uninitialized value in subroutine entry; for every iteration; and apparently does nothing?
Even if I could work out (why do I have to guess? Why isn't this stuff documented?) how to persuade hv_exists_ent() to use the pre-calculated hash value and ignore the SV it requires, setting that SV up costs more than recalculating the hash does -- which is what I was trying to avoid. What a dumb api. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
| [reply] [d/l] |
by NERDVANA (Priest) on Jul 11, 2018 at 04:02 UTC | |