Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: fd88a926b5a38da5bc8cb2bb248b141b48e1c71f
https://github.com/Perl/perl5/commit/fd88a926b5a38da5bc8cb2bb248b141b48e1c71f
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M gv.c
M hv.c
M op.c
M pp_ctl.c
M regcomp_invlist.c
Log Message:
-----------
Various functions - when a field is already zero, don't set it to zero.
SV bodies are Zero()ed when allocated/uprooted from an arena for use.
This commit changes instances where a fresh body field is unnecessarily
assigned a zero/NULL value into an assertion that the field already
contains the desired value.
Commit: 4072f1113f08a9447c95cec77c4655ce3c717135
https://github.com/Perl/perl5/commit/4072f1113f08a9447c95cec77c4655ce3c717135
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
newSVbool/_true/_false - assign the required values directly.
Prior to this commit, `newSVbool`, `newSV_true`, and `newSV_false` used
`newSVsv`, but that is less efficient than directly setting up the new
SV as it needs to be.
Commit: 25339eeade54125c3feee49d67ea89b4c9e3313e
https://github.com/Perl/perl5/commit/25339eeade54125c3feee49d67ea89b4c9e3313e
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M regexec.c
Log Message:
-----------
Perl_regexec_flags - create and populate a new SV in one call, not two.
Perl_regexec_flags had these lines to first create a new SV, then assign
to it the value(s) of an existing SV:
```
reginfo->sv = newSV_type(SVt_NULL);
SvSetSV_nosteal(reginfo->sv, sv);
```
This is two calls into _sv.c_ and, if the existing SV is `SvOK`, will
incur an SV upgrade in the process. Those lines are preceded with the
comment:
`Not newSVsv, either, as it does not COW.`
However, the underpinnings of `newSVsv` and variants do support COW
nowadays, so we can now just do:
```
reginfo->sv = newSVsv_flags(sv, SV_GMAGIC|SV_NOSTEAL|SV_DO_COW_SVSETSV);
```
Commit: 81dcd77fe5072eeddbaf8fa45f7433f9bd81dfba
https://github.com/Perl/perl5/commit/81dcd77fe5072eeddbaf8fa45f7433f9bd81dfba
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M pp.c
Log Message:
-----------
pp_index - create a SVt_PV directly, not via upgrade
Rather than create an `SVt_NULL`, then immediately to `sv_upgrade` it
(within the `sv_usepvn` call) to an SVt_PV, just create the SVt_PV in
the first place.
Commit: ba178617c4f7775f6e673f3d44f2e0393cd73bb2
https://github.com/Perl/perl5/commit/ba178617c4f7775f6e673f3d44f2e0393cd73bb2
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
Perl_newSV - entirely create the new SV within this function.
Since `new_XPV()` was added, this function can handle both branches of
`if (len)` without needing to call any other function. This should be
slightly more efficient for both branches.
Commit: fb1dc9855df433cd191651c007500807c68b7e08
https://github.com/Perl/perl5/commit/fb1dc9855df433cd191651c007500807c68b7e08
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
Perl_newSVrv - after a sv_clear, do the upgrade to SVt_IV inline.
Although this appears in an UNLIKELY branch, this commit shaves off
some CPU instructions and may generally help the compiler to
optimise the more likely branches.
Commit: 5cf65930f765c281126d5338dd732caa1fb5b35a
https://github.com/Perl/perl5/commit/5cf65930f765c281126d5338dd732caa1fb5b35a
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
Perl_newSVpvn_share - minor changes to help the compiler.
This commit:
* swaps `SvLEN_set(sv, 0)` for an assertion of this default value.
* Moves `SvCUR_set` and the (now-combined) flag assignment before the
call to `sharepvn`, giving the compiler a better chance to combine
them with the initialization (likely) inlined from `newSV_type(SVt_PV)`.
Commit: 3122115ed0d8c24e2d920a58711f36cd7301e473
https://github.com/Perl/perl5/commit/3122115ed0d8c24e2d920a58711f36cd7301e473
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
Perl_newSVhek - refactor to prioritize the overwhelming common case.
Existing comments highlighted the common case, confirmed by a _gcov_
build and run of the test harness.
For that workload:
* `(!hek)` is vanishingly rare
* `(flags & HVhek_NOTSHARED)` isn't hit by core at all.
* `(HEK_LEN(hek) == HEf_SVKEY)` was about 1% of calls.
The function was refactored in light of the existing comments and that
_gcov_ data. This also cut the number of resulting CPU instructions by
about half on a normal gcc build.
Commit: eb246bb290598c13fd3ae5e673650716ad056517
https://github.com/Perl/perl5/commit/eb246bb290598c13fd3ae5e673650716ad056517
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
S_sv_gets_append_to_utf8 - sv_gets upgrades tsv, so create SVt_PV directly.
Commit: 08b61580d0cfaeb6fada742a103a84cc6c544228
https://github.com/Perl/perl5/commit/08b61580d0cfaeb6fada742a103a84cc6c544228
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
Perl_newSVpvz - add some ASSUMEs to help the compiler
Commit: 043a9f33278c53eca7b8229f52cccdcadcaed8a9
https://github.com/Perl/perl5/commit/043a9f33278c53eca7b8229f52cccdcadcaed8a9
Author: Richard Leach <[email protected]>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M sv.c
Log Message:
-----------
Perl_sv_grow_fresh - set SvLEN before calling malloc
The compiler stands a better chance of optimising the function
this way around.
(e.g. A gcc build reduces from 20 instructions down to 15.)
Compare: https://github.com/Perl/perl5/compare/3adffaed3b5f...043a9f33278c
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications