Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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.


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-11-29 17:42 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls