From 8fcb24256a3027cbca7c100825eb3805586fe1e5 Mon Sep 17 00:00:00 2001 From: Richard Leach Date: Wed, 9 Feb 2022 21:53:55 +0000 Subject: 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 --- dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dump.c') diff --git a/dump.c b/dump.c index be53642147..e19f604bae 100644 --- a/dump.c +++ b/dump.c @@ -2693,7 +2693,7 @@ S_append_gv_name(pTHX_ GV *gv, SV *out) sv_catpvs_nomg(out, ""); return; } - sv = newSV(0); + sv = newSV_type(SVt_NULL); gv_fullname4(sv, gv, NULL, FALSE); Perl_sv_catpvf(aTHX_ out, "$%" SVf, SVfARG(sv)); SvREFCNT_dec_NN(sv); -- cgit v1.2.1