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

Re^2: performance of counting keys in a big hash

by demerphq (Chancellor)
on May 22, 2013 at 13:16 UTC ( [id://1034740]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    /* hash structure: */
    /* This structure must match the beginning of struct xpvmg in sv.h. */
    ...
        STRLEN      xhv_keys;       /* total keys, including placeholders 
    +*/
        STRLEN      xhv_max;        /* subscript of last element of xhv_ar
    +ray */
    };
    
  2. or download this
    /* the number of keys (including any placeholders) */
    #define XHvTOTALKEYS(xhv)       ((xhv)->xhv_keys)
    ...
    #define HvTOTALKEYS(hv)         XHvTOTALKEYS((XPVHV*)  SvANY(hv))
    #define HvPLACEHOLDERS(hv)      (*Perl_hv_placeholders_p(aTHX_ MUTABLE
    +_HV(hv)))
    #define HvPLACEHOLDERS_get(hv)  (SvMAGIC(hv) ? Perl_hv_placeholders_ge
    +t(aTHX_ (const HV *)hv) : 0)
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-19 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found