summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-11 18:06:30 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-11 18:06:30 +0000
commit409dfe773507bb644ee4393d7be6447672587c1d (patch)
tree5dd95d825d3ed373eaa386c1a1c19c781b622a3e /sv.c
parenta51caccf222faf8588ed061240391957b9a0e70d (diff)
downloadperl-409dfe773507bb644ee4393d7be6447672587c1d.tar.gz
Within Perl_newSVhek, inline most of newSVpvn_share(), because
share_hek_hek() is far more efficient than sharepvn(). p4raw-id: //depot/perl@27767
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index 02e83a1d02..e84b0e594d 100644
--- a/sv.c
+++ b/sv.c
@@ -6964,9 +6964,23 @@ Perl_newSVhek(pTHX_ const HEK *hek)
return sv;
}
/* This will be overwhelminly the most common case. */
- return newSVpvn_share(HEK_KEY(hek),
- (HEK_UTF8(hek) ? -HEK_LEN(hek) : HEK_LEN(hek)),
- HEK_HASH(hek));
+ {
+ /* Inline most of newSVpvn_share(), because share_hek_hek() is far
+ more efficient than sharepvn(). */
+ SV *sv;
+
+ new_SV(sv);
+ sv_upgrade(sv, SVt_PV);
+ SvPV_set(sv, (char *)HEK_KEY(share_hek_hek(hek)));
+ SvCUR_set(sv, HEK_LEN(hek));
+ SvLEN_set(sv, 0);
+ SvREADONLY_on(sv);
+ SvFAKE_on(sv);
+ SvPOK_on(sv);
+ if (HEK_UTF8(hek))
+ SvUTF8_on(sv);
+ return sv;
+ }
}
}