diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-03-10 12:29:56 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-03-10 12:29:56 +0000 |
commit | 5d27ee4af18b0f3857a1f951f91473c86da29b62 (patch) | |
tree | 3fffd7c64edcf05e2583b122301c1880ecc50514 /dump.c | |
parent | 6e2e048be95a027035f83c0f673f8de94e013c87 (diff) | |
download | perl-5d27ee4af18b0f3857a1f951f91473c86da29b62.tar.gz |
don't repeatedly call HvUSEDKEYS
HvUSEDKEYS contains a function call nowadays. Don't call it repeatedly.
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1882,20 +1882,22 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo } } break; - case SVt_PVHV: + case SVt_PVHV: { + U32 usedkeys; if (SvOOK(sv)) { struct xpvhv_aux *const aux = HvAUX(sv); Perl_dump_indent(aTHX_ level, file, " AUX_FLAGS = %"UVuf"\n", (UV)aux->xhv_aux_flags); } Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(HvARRAY(sv))); - if (HvARRAY(sv) && HvUSEDKEYS(sv)) { + usedkeys = HvUSEDKEYS(sv); + if (HvARRAY(sv) && usedkeys) { /* Show distribution of HEs in the ARRAY */ int freq[200]; #define FREQ_MAX ((int)(sizeof freq / sizeof freq[0] - 1)) int i; int max = 0; - U32 pow2 = 2, keys = HvUSEDKEYS(sv); + U32 pow2 = 2, keys = usedkeys; NV theoret, sum = 0; PerlIO_printf(file, " ("); @@ -1937,13 +1939,13 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo } while ((keys = keys >> 1)) pow2 = pow2 << 1; - theoret = HvUSEDKEYS(sv); + theoret = usedkeys; theoret += theoret * (theoret-1)/pow2; PerlIO_putc(file, '\n'); Perl_dump_indent(aTHX_ level, file, " hash quality = %.1"NVff"%%", theoret/sum*100); } PerlIO_putc(file, '\n'); - Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvUSEDKEYS(sv)); + Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)usedkeys); { STRLEN count = 0; HE **ents = HvARRAY(sv); @@ -2116,6 +2118,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo } } break; + } /* case SVt_PVHV */ case SVt_PVCV: if (CvAUTOLOAD(sv)) { |