Don't decrement the reference count of the element about to be stored
into.
Likely, this is an error in the caller, but doing this action blindly is
like shooting yourself in the foot. The branch prediction also added
ensures this shouldn't slow things down.
See http://nntp.perl.org/group/perl.perl5.porters/254974
}
AvFILLp(av) = key;
}
- else if (AvREAL(av))
- SvREFCNT_dec(ary[key]);
+ else if (AvREAL(av) && LIKELY(ary[key] != val))
+ SvREFCNT_dec(ary[key]);
ary[key] = val;
if (SvSMAGICAL(av)) {
const MAGIC *mg = SvMAGIC(av);