Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://561711]
help
Chatterbox?
[choroba]: :-D
[LanX]: What about Czech an Chechen ambessy?
[AnomalousMonk]: LanX: Rama had (has?) a high (much higher than typical asteroid) rate of axial (again, unusual, I think) spin for its artificial gravity.
LanX pity there is no Germs embassy ...
[choroba]: LanX We merged them to save money.
[LanX]: AnomalousMonk: yeah the asteroid but not the god, right?

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2017-11-22 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (327 votes). Check out past polls.

    Notices?