summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-02-09 21:53:55 +0000
committerxenu <me@xenu.pl>2022-03-07 01:08:53 +0100
commit8fcb24256a3027cbca7c100825eb3805586fe1e5 (patch)
treeef13c018bfdbee1dc73b5d38efdedd78614db471 /pp_hot.c
parent75acd14e43f2ffb698fc7032498f31095b56adb5 (diff)
downloadperl-8fcb24256a3027cbca7c100825eb3805586fe1e5.tar.gz
Inlined newSV_type(SVt_NULL) leaner than non-inlined newSV(0)
When a function outside of sv.c creates a SV via newSV(0): * There is a call to Perl_newSV * A SV head is uprooted and its flags set * A runtime check is made to effectively see if 0 > 0 * The new SV* is returned Replacing newSV(0) with newSV_type(SVt_NULL) should be more efficient, because (assuming there are SV heads to uproot), the only step is: * A SV head is uprooted and its flags set
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 477cdd48b8..ebd4b47e5d 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -4895,7 +4895,7 @@ Perl_leave_adjust_stacks(pTHX_ SV **from_sp, SV **to_sp, U8 gimme, int pass)
* ++PL_tmps_ix, moving the previous occupant there
* instead.
*/
- SV *newsv = newSV(0);
+ SV *newsv = newSV_type(SVt_NULL);
PL_tmps_stack[++PL_tmps_ix] = *tmps_basep;
/* put it on the tmps stack early so it gets freed if we die */
@@ -5510,7 +5510,7 @@ Perl_vivify_ref(pTHX_ SV *sv, U32 to_what)
prepare_SV_for_RV(sv);
switch (to_what) {
case OPpDEREF_SV:
- SvRV_set(sv, newSV(0));
+ SvRV_set(sv, newSV_type(SVt_NULL));
break;
case OPpDEREF_AV:
SvRV_set(sv, MUTABLE_SV(newAV()));