This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Inlined newSV_type(SVt_NULL) leaner than non-inlined newSV(0)
authorRichard Leach <richardleach@users.noreply.github.com>
Wed, 9 Feb 2022 21:53:55 +0000 (21:53 +0000)
committerxenu <me@xenu.pl>
Mon, 7 Mar 2022 00:08:53 +0000 (01:08 +0100)
commit8fcb24256a3027cbca7c100825eb3805586fe1e5
treeef13c018bfdbee1dc73b5d38efdedd78614db471
parent75acd14e43f2ffb698fc7032498f31095b56adb5
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
14 files changed:
av.c
dump.c
gv.c
hv.c
inline.h
op.c
pad.c
pp.c
pp_ctl.c
pp_hot.c
regexec.c
scope.c
sv.c
toke.c