diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2023-02-10 22:35:39 +0000 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2023-02-10 21:37:16 -0700 |
commit | c7342b06c24013ac518d5817617c3abbef7f0a1e (patch) | |
tree | 20c5a2392047fa32dcc34d87a78073fef89da156 /sv.c | |
parent | 2664c462411478c2f23e27a664b4b92f10b7453f (diff) | |
download | perl-c7342b06c24013ac518d5817617c3abbef7f0a1e.tar.gz |
Perl_sv_clear: faster treatment of bodyless NVs
The existing fast path for SVt_NULL/SVt_IV can also be used for bodyless
SVt_NVs.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -6623,8 +6623,11 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) assert(SvREFCNT(sv) == 0); assert(SvTYPE(sv) != (svtype)SVTYPEMASK); - +#if NVSIZE <= IVSIZE + if (type <= SVt_NV) { +#else if (type <= SVt_IV) { +#endif /* Historically this check on type was needed so that the code to * free bodies wasn't reached for these types, because the arena * slots were re-used for HEs and pointer table entries. The @@ -6646,6 +6649,9 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) * path, as SvPVX() doesn't point to valid memory. * * Hence this code is still the most efficient way to handle this. + * + * Additionally, for bodyless NVs, riding this branch is more + * efficient than stepping through the general logic. */ if (SvROK(sv)) |