diff options
author | David Mitchell <davem@iabyn.com> | 2010-07-05 22:25:12 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-07-14 23:06:17 +0100 |
commit | 96bafef935f82644670a19c8ca57886c240cd969 (patch) | |
tree | e70a660dd400ee683de795ef1d64c76258aae751 | |
parent | ab95db60dabd8d8c36f2a83a140b52898d8d4f68 (diff) | |
download | perl-96bafef935f82644670a19c8ca57886c240cd969.tar.gz |
in CLONEf_JOIN_IN, cache found stashes
When joining a thread, we skip cloning a stash if a stash of the same
name already exists in the parent thread. Add it to PL_ptr_table too, so
we don't have to repeat the expensive name comparison each time
-rw-r--r-- | sv.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -11071,9 +11071,12 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) something that is bad **/ if (SvTYPE(sstr) == SVt_PVHV) { const HEK * const hvname = HvNAME_HEK(sstr); - if (hvname) + if (hvname) { /** don't clone stashes if they already exist **/ - return MUTABLE_SV(gv_stashpvn(HEK_KEY(hvname), HEK_LEN(hvname), 0)); + dstr = MUTABLE_SV(gv_stashpvn(HEK_KEY(hvname), HEK_LEN(hvname), 0)); + ptr_table_store(PL_ptr_table, sstr, dstr); + return dstr; + } } } |