Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Using SV as key in hash

by liz (Monsignor)
on Jul 17, 2006 at 08:52 UTC ( #561711=note: print w/ replies, xml ) Need Help??


in reply to Re: Using SV as key in hash
in thread Using SV as key in hash

Hmmm... Are you implying that by default key values are already shared? As this code in sv.c seems to imply:

HV * Perl_newHV(pTHX) { register HV *hv; register XPVHV* xhv; hv = (HV*)NEWSV(502,0); sv_upgrade((SV *)hv, SVt_PVHV); xhv = (XPVHV*)SvANY(hv); SvPOK_off(hv); SvNOK_off(hv); #ifndef NODEFAULT_SHAREKEYS HvSHAREKEYS_on(hv); /* key-sharing on by default */ #endif

But I assume then that what is being shared, are char * rather than SV's? And sharing between different hashes doesn't really solve my optimization "problem", as I only want to use one hash. It's just that in many cases the value is the same as the key, and that it would therefore make sense to have them share the same SV.

Liz


Comment on Re^2: Using SV as key in hash
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-12-23 02:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (133 votes), past polls