In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/79e2a32a095274dde38cabdeca03b580bd9733d7?hp=ba4c68a684c8a192588b31d76b572cc26bef9ee2>

- Log -----------------------------------------------------------------
commit 79e2a32a095274dde38cabdeca03b580bd9733d7
Author: Steffen Mueller <smuel...@cpan.org>
Date:   Tue Jun 11 18:59:18 2013 +0200

    Branch prediction hint for SvREFCNT_dec
    
    When decrementing the refcount on an SV, we have to branch on whether or
    not we've reached a refcount of 0. But a quick instrumentation shows
    that in virtually any program small or large, the number of decrements
    without freeing greatly outweighs the number of decrements that cause a
    free. Therefore, it's a net win to suggest to the compiler to emit a
    branch prediction hint to go into the just-decrement branch.

M       inline.h

commit 586fc6a31347339bf2b16e391b44aa458f723283
Author: Steffen Mueller <smuel...@cpan.org>
Date:   Tue Jun 11 18:41:07 2013 +0200

    Remove magic literal constant in favor of named constant
    
    For clarity only

M       sv.c
-----------------------------------------------------------------------

Summary of changes:
 inline.h |    4 ++--
 sv.c     |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/inline.h b/inline.h
index 953bb33..29a15ac 100644
--- a/inline.h
+++ b/inline.h
@@ -67,7 +67,7 @@ S_SvREFCNT_dec(pTHX_ SV *sv)
 {
     if (LIKELY(sv != NULL)) {
        U32 rc = SvREFCNT(sv);
-       if (rc > 1)
+       if (LIKELY(rc > 1))
            SvREFCNT(sv) = rc - 1;
        else
            Perl_sv_free2(aTHX_ sv, rc);
@@ -78,7 +78,7 @@ PERL_STATIC_INLINE void
 S_SvREFCNT_dec_NN(pTHX_ SV *sv)
 {
     U32 rc = SvREFCNT(sv);
-    if (rc > 1)
+    if (LIKELY(rc > 1))
        SvREFCNT(sv) = rc - 1;
     else
        Perl_sv_free2(aTHX_ sv, rc);
diff --git a/sv.c b/sv.c
index 8222aae..d10e5a5 100644
--- a/sv.c
+++ b/sv.c
@@ -1308,7 +1308,8 @@ Perl_sv_upgrade(pTHX_ SV *const sv, svtype new_type)
 #ifndef NODEFAULT_SHAREKEYS
            HvSHAREKEYS_on(sv);         /* key-sharing on by default */
 #endif
-           HvMAX(sv) = 7; /* (start with 8 buckets) */
+            /* start with PERL_HASH_DEFAULT_HvMAX+1 buckets: */
+           HvMAX(sv) = PERL_HASH_DEFAULT_HvMAX;
        }
 
        /* SVt_NULL isn't the only thing upgraded to AV or HV.

--
Perl5 Master Repository

Reply via email to